diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-08-11 16:14:28 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-08-11 16:14:28 +0000 |
commit | 8b1962153814426bfb7e4ab38056ffa955d7c3f0 (patch) | |
tree | 11587cd185ead1fbde5db79af1fd604cf24b37cb | |
parent | 54283b7e7aa702e9334cf886344d309e5d9f9871 (diff) | |
download | sequelpro-8b1962153814426bfb7e4ab38056ffa955d7c3f0.tar.gz sequelpro-8b1962153814426bfb7e4ab38056ffa955d7c3f0.tar.bz2 sequelpro-8b1962153814426bfb7e4ab38056ffa955d7c3f0.zip |
• db schema names à la db.table.field or real numbers like 1.234 are treated as one 'word' while navigating/selecting by the keyboard
- first patch for solving issue 588
- needs to be tested if this behaviour doesn't disturb other issues
Note: it's in some sort tricky since the selection direction isn't caught yet
-rw-r--r-- | Source/SPTextView.m | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/SPTextView.m b/Source/SPTextView.m index 4b906ed0..a8ba29c8 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -2264,6 +2264,37 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) } +/* + * The following moveWord... routines are needed to be able to recognize a db schema à la + * db.table.field as ONE word while navigating and selecting by the keyboard + */ +- (void)moveWordRight:(id)sender +{ + [super moveWordRight:sender]; + while([self selectedRange].location < [[[self textStorage] string] length] && [[[self textStorage] string] characterAtIndex:[self selectedRange].location] == '.') + [super moveWordRight:sender]; +} + +- (void)moveWordLeft:(id)sender +{ + [super moveWordLeft:sender]; + while([self selectedRange].location > 0 && [[[self textStorage] string] characterAtIndex:[self selectedRange].location-1] == '.') + [super moveWordLeft:sender]; +} + +- (void)moveWordLeftAndModifySelection:(id)sender +{ + [super moveWordLeftAndModifySelection:sender]; + while([self selectedRange].location > 0 && [[[self textStorage] string] characterAtIndex:[self selectedRange].location-1] == '.') + [super moveWordLeftAndModifySelection:sender]; +} + +- (void)moveWordRightAndModifySelection:(id)sender +{ + [super moveWordRightAndModifySelection:sender]; + while(NSMaxRange([self selectedRange]) < [[[self textStorage] string] length] && [[[self textStorage] string] characterAtIndex:NSMaxRange([self selectedRange])] == '.') + [super moveWordRightAndModifySelection:sender]; +} - (void) deleteBackward:(id)sender { |