From 6494b7ea894ef0f1fcf813596ee8a7d9787f3e63 Mon Sep 17 00:00:00 2001 From: daboe01 Date: Mon, 25 May 2015 21:21:32 +0200 Subject: [PATCH] smart cut fix --- AppKit/CPTextView/CPTextView.j | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index 4dd6be0bc..377044398 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -1244,12 +1244,11 @@ var kDelegateRespondsTo_textShouldBeginEditing else changedRange = _selectionRange; - if (!ignoreFlag && _previousSelectionGranularity > 0 && - changedRange.location > 0 && [self _isCharacterAtIndex:(changedRange.location - 1) granularity:_previousSelectionGranularity] && - changedRange.location < [[self string] length] && [self _isCharacterAtIndex:CPMaxRange(changedRange) granularity:_previousSelectionGranularity]) - { + // smart delete + if (!ignoreFlag && _copySelectionGranularity > 0 && + changedRange.location > 0 && _isWhitespaceCharacter([[_textStorage string] characterAtIndex:_selectionRange.location - 1]) && + changedRange.location < [[self string] length] && _isWhitespaceCharacter([[_textStorage string] characterAtIndex:CPMaxRange(changedRange)])) changedRange.length++; - } [self _deleteForRange:changedRange]; }