diff options
author | Bibiko <bibiko@eva.mpg.de> | 2011-01-21 11:07:53 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2011-01-21 11:07:53 +0000 |
commit | b06fec39e31ded08c69588ea35b8a5d01bbcb684 (patch) | |
tree | 187e9f49c95c6ea0fd4f8546189e08c49128abc9 /Source/SPNarrowDownCompletion.m | |
parent | 683e3390b06f1db3df1dff6f5b3df8f37a3b461f (diff) | |
download | sequelpro-b06fec39e31ded08c69588ea35b8a5d01bbcb684.tar.gz sequelpro-b06fec39e31ded08c69588ea35b8a5d01bbcb684.tar.bz2 sequelpro-b06fec39e31ded08c69588ea35b8a5d01bbcb684.zip |
• fixed completion issue via alias names
Diffstat (limited to 'Source/SPNarrowDownCompletion.m')
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 18 |
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 |