Change move word forwoard to move to the next end of a word rather

than the beginning of the next word so users can quickly navigate to
either end of words.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30056 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2010-03-27 21:51:33 +00:00
parent f3b6c1fe6f
commit bed9ea8c64
2 changed files with 12 additions and 8 deletions

View file

@ -1,5 +1,9 @@
2010-03-27 Wolfgang Lux <wolfgang.lux@gmail.com> 2010-03-27 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSAttributedString.m (-nextWordFromIndex:forward:):
Move to the next end of a word rather than the beginning of the
next word so users can quickly navigate to either end of words.
* Source/NSTextView.m (-setSelectedRange:affinity:stillSelecting:): * Source/NSTextView.m (-setSelectedRange:affinity:stillSelecting:):
* Source/NSTextView_actions.m (-deleteForward:, -deleteBackward:, * Source/NSTextView_actions.m (-deleteForward:, -deleteBackward:,
-deleteToEndOfLine:): Usability improvements: When setting the -deleteToEndOfLine:): Usability improvements: When setting the

View file

@ -577,18 +577,18 @@ create_error(int code, NSString* desc)
if (isForward) if (isForward)
{ {
/* What we want to do is: move forward to the next chunk of word /* What we want to do is: move forward to the next chunk of
separator characters, skip them all, and return the location non-word separator characters, skip them all, and return the
just after them. */ location just after them. */
if (location == length) if (location == length)
{ {
return length; return length;
} }
/* Move forward to the next word-separator. */ /* Move forward to the next non-word separator. */
range = NSMakeRange (location, length - location); range = NSMakeRange (location, length - location);
range = [str rangeOfCharacterFromSet: wordBreakCSet range = [str rangeOfCharacterFromSet: wordCSet
options: NSLiteralSearch options: NSLiteralSearch
range: range]; range: range];
if (range.location == NSNotFound) if (range.location == NSNotFound)
@ -596,12 +596,12 @@ create_error(int code, NSString* desc)
return length; return length;
} }
/* rangeOfCharacterFromSet: options: range: only returns the range /* rangeOfCharacterFromSet: options: range: only returns the range
of the first word-separator character ... we want to skip of the first non-word-separator character ... we want to skip
them all! So we need to search again, this time for the them all! So we need to search again, this time for the
first non-word-separator character, and return the first such first word-separator character, and return the first such
character. */ character. */
range = NSMakeRange (range.location, length - range.location); range = NSMakeRange (range.location, length - range.location);
range = [str rangeOfCharacterFromSet: wordCSet range = [str rangeOfCharacterFromSet: wordBreakCSet
options: NSLiteralSearch options: NSLiteralSearch
range: range]; range: range];
if (range.location == NSNotFound) if (range.location == NSNotFound)