From 8b1962153814426bfb7e4ab38056ffa955d7c3f0 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Wed, 11 Aug 2010 16:14:28 +0000 Subject: =?UTF-8?q?=E2=80=A2=20db=20schema=20names=20=C3=A0=20la=20db.tabl?= =?UTF-8?q?e.field=20or=20real=20numbers=20like=201.234=20are=20treated=20?= =?UTF-8?q?as=20one=20'word'=20while=20navigating/selecting=20by=20the=20k?= =?UTF-8?q?eyboard=20-=20first=20patch=20for=20solving=20issue=20588=20-?= =?UTF-8?q?=20needs=20to=20be=20tested=20if=20this=20behaviour=20doesn't?= =?UTF-8?q?=20disturb=20other=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note: it's in some sort tricky since the selection direction isn't caught yet --- Source/SPTextView.m | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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 { -- cgit v1.2.3