redo support added

This commit is contained in:
daboe01
2014-11-29 18:57:05 +01:00
parent bd71e779c3
commit 5f2fee5a99
+8
View File
@@ -429,6 +429,10 @@ var kDelegateRespondsTo_textShouldBeginEditing
- (void)_replaceCharactersInRange:aRange withAttributedString:(CPString)aString
{
[[[[self window] undoManager] prepareWithInvocationTarget:self]
_replaceCharactersInRange:CPMakeRange(aRange.location, [aString length])
withAttributedString:[_textStorage attributedSubstringFromRange:CPMakeRangeCopy(aRange)]];
[_textStorage replaceCharactersInRange:aRange withAttributedString:aString];
[self setSelectedRange:CPMakeRange(aRange.location, [aString length])];
[_layoutManager _validateLayoutAndGlyphs];
@@ -439,6 +443,10 @@ var kDelegateRespondsTo_textShouldBeginEditing
}
- (void)_replaceCharactersInRange:(CPRange)aRange withString:(CPString)aString
{
[[[[self window] undoManager] prepareWithInvocationTarget:self]
_replaceCharactersInRange:CPMakeRange(aRange.location, [aString length])
withString:[[self string] substringWithRange:CPMakeRangeCopy(aRange)]];
[_textStorage replaceCharactersInRange:CPMakeRangeCopy(aRange) withString:aString];
[self setSelectedRange:CPMakeRange(aRange.location, aString.length)];
[_layoutManager _validateLayoutAndGlyphs];