aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2011-01-21 09:45:30 +0000
committerBibiko <bibiko@eva.mpg.de>2011-01-21 09:45:30 +0000
commit46b8b95acd0df8c82996fd54266f58662db6a4cd (patch)
tree0bed8797106bdd52da8c5823613477bf01fe15c2
parent231f4a4e70807e9824fd3c14c3bd258b37e0dbe4 (diff)
downloadsequelpro-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
-rw-r--r--Source/SPNarrowDownCompletion.m19
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];