diff options
author | Bibiko <bibiko@eva.mpg.de> | 2011-01-21 13:39:05 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2011-01-21 13:39:05 +0000 |
commit | 0870d91feccb241d1e8f186a48c3a83d3b26a1ed (patch) | |
tree | 28b48031dd15a7c750fa6a99ae222f0a4da05315 | |
parent | 28819b6ab639d29bf5e5897e7ac4c784771d3651 (diff) | |
download | sequelpro-0870d91feccb241d1e8f186a48c3a83d3b26a1ed.tar.gz sequelpro-0870d91feccb241d1e8f186a48c3a83d3b26a1ed.tar.bz2 sequelpro-0870d91feccb241d1e8f186a48c3a83d3b26a1ed.zip |
• removed temporary method getRangeForCurrentWordForCompletion
-rw-r--r-- | Source/SPTextView.m | 2 | ||||
-rw-r--r-- | Source/SPTextViewAdditions.h | 1 | ||||
-rw-r--r-- | Source/SPTextViewAdditions.m | 72 |
3 files changed, 1 insertions, 74 deletions
diff --git a/Source/SPTextView.m b/Source/SPTextView.m index cd6e22ff..734949f1 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -606,7 +606,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) NSString* filter; NSString* dbName = nil; NSString* tableName = nil; - NSRange completionRange = [self getRangeForCurrentWordForCompletion]; + NSRange completionRange = [self getRangeForCurrentWord]; NSRange parseRange = completionRange; NSString* currentWord = [[self string] substringWithRange:completionRange]; NSString* prefix = @""; diff --git a/Source/SPTextViewAdditions.h b/Source/SPTextViewAdditions.h index b4692aee..013d8872 100644 --- a/Source/SPTextViewAdditions.h +++ b/Source/SPTextViewAdditions.h @@ -25,7 +25,6 @@ @interface NSTextView (SPTextViewAdditions) - (NSRange)getRangeForCurrentWord; -- (NSRange)getRangeForCurrentWordForCompletion; - (IBAction)selectCurrentWord:(id)sender; - (IBAction)selectCurrentLine:(id)sender; diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m index e5a15421..6723fa7f 100644 --- a/Source/SPTextViewAdditions.m +++ b/Source/SPTextViewAdditions.m @@ -66,78 +66,6 @@ return(NSMakeRange(start, end-start)); } -/* - * Returns the range of the current word. - * finds: [| := caret] |word wo|rd word| - * If | is in between whitespaces nothing will be selected. - */ -- (NSRange)getRangeForCurrentWordForCompletion -{ - NSRange curRange = [self selectedRange]; - - if (curRange.length) - return curRange; - - NSUInteger curLocation = curRange.location; - - NSMutableCharacterSet *wordCharSet = [NSMutableCharacterSet alphanumericCharacterSet]; - [wordCharSet addCharactersInString:@"_."]; - [wordCharSet removeCharactersInString:@"`"]; - - NSInteger start = curLocation; - NSInteger end = curLocation; - - if(start) { - start--; - while([wordCharSet characterIsMember:[[self string] characterAtIndex:start]]) { - start--; - if(start < 0) break; - } - start++; - } - - NSUInteger strLen = [[self string] length]; - if(end <= strLen-1) { - while(end < strLen && [wordCharSet characterIsMember:[[self string] characterAtIndex:end]]) { - end++; - } - } - return(NSMakeRange(start, end-start)); - - [self moveWordLeft:self]; - [self moveWordRightAndModifySelection:self]; - - NSUInteger newStartRange = [self selectedRange].location; - NSUInteger newEndRange = newStartRange + [self selectedRange].length; - - // if current location does not intersect with found range - // then caret is at the begin of a word -> change strategy - if(curLocation < newStartRange || curLocation > newEndRange) - { - [self setSelectedRange:curRange]; - [self moveWordRight:self]; - [self moveWordLeftAndModifySelection:self]; - newStartRange = [self selectedRange].location; - newEndRange = newStartRange + [self selectedRange].length; - } - - // how many space in front of the selection - NSInteger bias = [self selectedRange].length - [[[[self string] substringWithRange:[self selectedRange]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length]; - [self setSelectedRange:NSMakeRange([self selectedRange].location+bias, [self selectedRange].length-bias)]; - newStartRange += bias; - newEndRange -= bias; - - // is caret inside the selection still? - if(curLocation < newStartRange || curLocation > newEndRange - || [[[self string] substringWithRange:[self selectedRange]] rangeOfCharacterFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].location != NSNotFound) - [self setSelectedRange:curRange]; - - NSRange wordRange = [self selectedRange]; - - [self setSelectedRange:curRange]; - - return(wordRange); -} /* * Select current word. |