From 42a20ff3dd919d89243f6bceb563fb450f74acf2 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 15 Jan 2010 15:09:11 +0000 Subject: =?UTF-8?q?-=20removed=20F5=20completion=20debug=20output=20-=20fi?= =?UTF-8?q?xed=20issue=20while=20=E2=80=98normal=E2=80=99=20completion=20a?= =?UTF-8?q?fter=20=E2=80=9Ctable.=E2=80=9D=20completion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CMTextView.m | 4 ++-- Source/SPNarrowDownCompletion.m | 31 ++++++++++++++++--------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 6c2bd7a3..c3b27987 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -450,9 +450,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) if([[self string] length] > parseRange.location+parseRange.length) { if([[self string] characterAtIndex:parseRange.location+parseRange.length] == '`') { backtickMode+=2; - NSLog(@"a %@", NSStringFromRange(parseRange)); parseRange.length++; // adjust parse string for right ` - NSLog(@"b %@", NSStringFromRange(parseRange)); } } @@ -470,6 +468,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) } else { filter = [[parsedString stringByReplacingOccurrencesOfString:@"``" withString:@"`"] stringByReplacingOccurrencesOfRegex:@"^`|`$" withString:@""]; } + if(![filter length]) + completionRange = NSMakeRange(parseRange.location+parseRange.length,0); } else { filter = [NSString stringWithString:currentWord]; } diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index 16438a56..82564567 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -572,25 +572,26 @@ } else { NSMutableDictionary* selectedItem = [[[filtered objectAtIndex:[theTableView selectedRow]] mutableCopy] autorelease]; NSString* candidateMatch = [selectedItem objectForKey:@"match"] ?: [selectedItem objectForKey:@"display"]; - if([[selectedItem objectForKey:@"path"] length] && [[NSApp currentEvent] modifierFlags] & (NSShiftKeyMask)) { - NSString *path = [NSString stringWithFormat:@"%@.%@", - [[[[[selectedItem objectForKey:@"path"] componentsSeparatedByString:@"⇠"] reverseObjectEnumerator] allObjects] componentsJoinedByPeriodAndBacktickQuoted], - [candidateMatch backtickQuotedString]]; - - // Check if path's db name is the current selected db name - NSRange r = [path rangeOfString:[currentDb backtickQuotedString] options:NSCaseInsensitiveSearch range:NSMakeRange(0, [[currentDb backtickQuotedString] length])]; - theCharRange = theParseRange; - backtickMode = 0; // suppress move the caret one step rightwards - if(path && [path length] && r.length) - [self insert_text:[path substringFromIndex:r.length+1]]; - else - [self insert_text:path]; - + if( [[NSApp currentEvent] modifierFlags] & (NSShiftKeyMask)) { + if([[selectedItem objectForKey:@"path"] length]) { + NSString *path = [NSString stringWithFormat:@"%@.%@", + [[[[[selectedItem objectForKey:@"path"] componentsSeparatedByString:@"⇠"] reverseObjectEnumerator] allObjects] componentsJoinedByPeriodAndBacktickQuoted], + [candidateMatch backtickQuotedString]]; + + // Check if path's db name is the current selected db name + NSRange r = [path rangeOfString:[currentDb backtickQuotedString] options:NSCaseInsensitiveSearch range:NSMakeRange(0, [[currentDb backtickQuotedString] length])]; + theCharRange = theParseRange; + backtickMode = 0; // suppress move the caret one step rightwards + if(path && [path length] && r.length) { + [self insert_text:[path substringFromIndex:r.length+1]]; + } else { + [self insert_text:path]; + } + } } else { if([[self filterString] length] < [candidateMatch length]) [self insert_text:candidateMatch]; } - } closeMe = YES; } -- cgit v1.2.3