aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPNarrowDownCompletion.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPNarrowDownCompletion.m')
-rw-r--r--Source/SPNarrowDownCompletion.m18
1 files changed, 12 insertions, 6 deletions
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m
index b0c2bc02..abc00d9a 100644
--- a/Source/SPNarrowDownCompletion.m
+++ b/Source/SPNarrowDownCompletion.m
@@ -215,7 +215,7 @@
dictMode:(BOOL)mode dbMode:(BOOL)theDbMode tabTriggerMode:(BOOL)tabTriggerMode fuzzySearch:(BOOL)fuzzySearch
backtickMode:(NSInteger)theBackTickMode withDbName:(NSString*)dbName withTableName:(NSString*)tableName
selectedDb:(NSString*)selectedDb caretMovedLeft:(BOOL)caretMovedLeft autoComplete:(BOOL)autoComplete oneColumn:(BOOL)oneColumn
- isQueryingDBStructure:(BOOL)isQueryingDBStructure
+ alias:(NSString*)anAlias isQueryingDBStructure:(BOOL)isQueryingDBStructure
{
if(self = [self init])
{
@@ -228,6 +228,7 @@
autoCompletionMode = autoComplete;
+ theAliasName = anAlias;
oneColumnMode = oneColumn;
isQueryingDatabaseStructure = isQueryingDBStructure;
@@ -1030,12 +1031,17 @@
[theView setSelectedRange:r];
else {
if(backtickMode == 100) {
- BOOL nextCharIsBacktick = ([[[theView string] substringWithRange:theCharRange] hasSuffix:@"`"]);
+ NSString *replaceString = [[theView string] substringWithRange:theCharRange];
+ BOOL nextCharIsBacktick = ([replaceString hasSuffix:@"`"]);
if(theCharRange.length == 1) nextCharIsBacktick = NO;
- if(!nextCharIsBacktick)
- [theView setSelectedRange:NSMakeRange(theCharRange.location, theCharRange.length+2)];
- else
+ if(!nextCharIsBacktick) {
+ if([replaceString hasPrefix:@"`"])
+ [theView setSelectedRange:NSMakeRange(theCharRange.location, theCharRange.length+2)];
+ else
+ [theView setSelectedRange:theCharRange];
+ } else {
[theView setSelectedRange:theCharRange];
+ }
backtickMode = 0;
} else
[theView setSelectedRange:theCharRange];
@@ -1073,7 +1079,7 @@
NSString* candidateMatch = [selectedItem objectForKey:@"match"] ?: [selectedItem objectForKey:@"display"];
if([selectedItem objectForKey:@"isRef"]
&& ([[NSApp currentEvent] modifierFlags] & (NSShiftKeyMask))
- && [[selectedItem objectForKey:@"path"] length]) {
+ && [[selectedItem objectForKey:@"path"] length] && theAliasName == nil) {
NSString *path = [[[selectedItem objectForKey:@"path"] componentsSeparatedByString:SPUniqueSchemaDelimiter] componentsJoinedByPeriodAndBacktickQuotedAndIgnoreFirst];
// Check if path's db name is the current selected db name