fix range exception when smart-cutting last word

This commit is contained in:
daboe01 committed 2014-10-20 18:51:26 +02:00
1 parent 49c7e7ce2d
commit 18d83b8c50
1 file changed
+2
+2
View File
@@ -1228,6 +1228,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
if (![self shouldChangeTextInRange:changedRange replacementString:@""])
return;
changedRange = CPIntersectionRange(CPMakeRange(0, [_layoutManager numberOfCharacters]), changedRange);
[[[[self window] undoManager] prepareWithInvocationTarget:self] _replaceCharactersInRange:CPMakeRange(_selectionRange.location, 0) withAttributedString:[_textStorage attributedSubstringFromRange:CPMakeRangeCopy(changedRange)]];
[_textStorage deleteCharactersInRange:CPMakeRangeCopy(changedRange)];