diff options
author | Bibiko <bibiko@eva.mpg.de> | 2011-01-21 09:45:30 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2011-01-21 09:45:30 +0000 |
commit | 46b8b95acd0df8c82996fd54266f58662db6a4cd (patch) | |
tree | 0bed8797106bdd52da8c5823613477bf01fe15c2 /Source/SPNarrowDownCompletion.m | |
parent | 231f4a4e70807e9824fd3c14c3bd258b37e0dbe4 (diff) | |
download | sequelpro-46b8b95acd0df8c82996fd54266f58662db6a4cd.tar.gz sequelpro-46b8b95acd0df8c82996fd54266f58662db6a4cd.tar.bz2 sequelpro-46b8b95acd0df8c82996fd54266f58662db6a4cd.zip |
• fixed issue for placeholder insertion while completion of already backticked names and the final insertion
Diffstat (limited to 'Source/SPNarrowDownCompletion.m')
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index f86c66c5..d6272d5b 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -953,8 +953,10 @@ NSString* toInsert = [curMatch substringFromIndex:[originalFilterString length]]; theCharRange.length += [toInsert length] - currentAutocompleteLength; theParseRange.length += [toInsert length]; + [theView breakUndoCoalescing]; [theView insertText:[toInsert lowercaseString]]; + autocompletePlaceholderWasInserted = YES; // Restore the text selection location, and clearly mark the autosuggested text @@ -971,7 +973,11 @@ if (!autocompletePlaceholderWasInserted) return; if (useFastMethod) { - [theView setSelectedRange:theCharRange]; + if(backtickMode) { + NSRange r = NSMakeRange(theCharRange.location+1,theCharRange.length); + [theView setSelectedRange:r]; + } else + [theView setSelectedRange:theCharRange]; [theView insertText:originalFilterString]; } else { NSRange attributeResultRange = NSMakeRange(0, 0); @@ -1018,8 +1024,12 @@ NSRange r = [theView selectedRange]; if(r.length) [theView setSelectedRange:r]; - else - [theView setSelectedRange:theCharRange]; + else { + if(backtickMode) + [theView setSelectedRange:NSMakeRange(theCharRange.location, theCharRange.length+2)]; + else + [theView setSelectedRange:theCharRange]; + } [theView insertText:aString]; @@ -1055,7 +1065,6 @@ && [[selectedItem objectForKey:@"path"] length]) { NSString *path = [[[selectedItem objectForKey:@"path"] componentsSeparatedByString:SPUniqueSchemaDelimiter] componentsJoinedByPeriodAndBacktickQuotedAndIgnoreFirst]; - // 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; @@ -1068,7 +1077,7 @@ } else { // Is completion string a schema name for current connection if([selectedItem objectForKey:@"isRef"]) { - backtickMode = 0; // suppress move the caret one step rightwards + // backtickMode = 0; // suppress move the caret one step rightwards [self insert_text:[candidateMatch backtickQuotedString]]; } else { [self insert_text:candidateMatch]; |