mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-29 03:18:50 +00:00
smart cutting+cleanup
This commit is contained in:
1 parent
ddbe0af290
commit
07a0be303f
1 file changed
+7
-12
@@ -27,8 +27,6 @@
|
||||
@import "CPTextStorage.j"
|
||||
@import "CPTextContainer.j"
|
||||
@import "CPFontManager.j"
|
||||
//@import "_CPRTFProducer.j"
|
||||
//@import "_CPRTFParser.j"
|
||||
@import "CPLayoutManager.j"
|
||||
|
||||
@class _CPRTFProducer;
|
||||
@@ -128,16 +126,6 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
CPLog.error(@"-[CPText " + _cmd + "] subclass responsibility");
|
||||
}
|
||||
|
||||
- (void)cut:(id)sender
|
||||
{
|
||||
[self copy:sender];
|
||||
|
||||
var loc = [self selectedRange].location;
|
||||
|
||||
[self replaceCharactersInRange:[self selectedRange] withString:""];
|
||||
[self setSelectedRange:CPMakeRange(loc,0) ];
|
||||
}
|
||||
|
||||
- (void)delete:(id)sender
|
||||
{
|
||||
CPLog.error(@"-[CPText "+_cmd+"] subclass responsibility");
|
||||
@@ -291,6 +279,7 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
CPRange _selectionRange;
|
||||
CPDictionary _selectedTextAttributes;
|
||||
int _selectionGranularity;
|
||||
int _previousSelectionGranularity;
|
||||
|
||||
CPColor _insertionPointColor;
|
||||
|
||||
@@ -831,6 +820,7 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
|
||||
- (void)mouseUp:(CPEvent)event
|
||||
{
|
||||
_previousSelectionGranularity = [self selectionGranularity];
|
||||
/* will post CPTextViewDidChangeSelectionNotification */
|
||||
[self setSelectionGranularity:CPSelectByCharacter];
|
||||
[self setSelectedRange:[self selectedRange] affinity:0 stillSelecting:NO];
|
||||
@@ -1273,6 +1263,11 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
else
|
||||
changedRange = _selectionRange;
|
||||
|
||||
if (_previousSelectionGranularity > 0 &&
|
||||
changedRange.location > 0 && [self _isCharacterAtIndex:changedRange.location-1 granularity:_previousSelectionGranularity] &&
|
||||
changedRange.location < [[self string] length] && [self _isCharacterAtIndex:CPMaxRange(changedRange) granularity:_previousSelectionGranularity])
|
||||
changedRange.length++;
|
||||
|
||||
[self _deleteForRange:changedRange];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user