Implement smart insert and delete and use it when cutting, copying,

pasting, and deleting full words in a text view or text field.

Note: I have changed NSTextView initialization to enable smart insert
and delete by default, since this is the default on OS X. (It is even
documented, though in a maybe obscure place, cf. "Text Editing
Programming Guide for Cocoa: Subclassing NSTextView".)  However, this
means that support for this feature will be somewhat inconsistent.
Smart insert and delete is enabled for text views created
programmatically (including the field editor), but not for text views
loaded from existing nib files.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29426 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
wlux 2010-01-27 23:26:09 +00:00
parent 8369ad55c1
commit d1faa4b3b4
4 changed files with 232 additions and 31 deletions

View file

@ -586,6 +586,11 @@ static NSNumber *float_plus_one(NSNumber *cur)
return;
}
}
else if ([self smartInsertDeleteEnabled] &&
[self selectionGranularity] == NSSelectByWord)
{
range = [self smartDeleteRangeForProposedRange: range];
}
if (![self shouldChangeTextInRange: range replacementString: @""])
{
@ -625,6 +630,11 @@ static NSNumber *float_plus_one(NSNumber *cur)
return;
}
}
else if ([self smartInsertDeleteEnabled] &&
[self selectionGranularity] == NSSelectByWord)
{
range = [self smartDeleteRangeForProposedRange: range];
}
if (![self shouldChangeTextInRange: range replacementString: @""])
{