aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CMTextView.m4
-rw-r--r--Source/SPNarrowDownCompletion.m31
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;
}