diff options
author | Bibiko <bibiko@eva.mpg.de> | 2011-01-21 10:35:32 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2011-01-21 10:35:32 +0000 |
commit | 683e3390b06f1db3df1dff6f5b3df8f37a3b461f (patch) | |
tree | 77391f7cd1efa9f6833d18af7c77ae642fbe83a7 /Source/SPNarrowDownCompletion.m | |
parent | 46b8b95acd0df8c82996fd54266f58662db6a4cd (diff) | |
download | sequelpro-683e3390b06f1db3df1dff6f5b3df8f37a3b461f.tar.gz sequelpro-683e3390b06f1db3df1dff6f5b3df8f37a3b461f.tar.bz2 sequelpro-683e3390b06f1db3df1dff6f5b3df8f37a3b461f.zip |
• fixed issue for placeholder insertion while completion of already backticked names and the final insertion - part 2
- also fixed undo behaviour
Diffstat (limited to 'Source/SPNarrowDownCompletion.m')
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index d6272d5b..b0c2bc02 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -972,6 +972,8 @@ { if (!autocompletePlaceholderWasInserted) return; + [theView breakUndoCoalescing]; + if (useFastMethod) { if(backtickMode) { NSRange r = NSMakeRange(theCharRange.location+1,theCharRange.length); @@ -1021,16 +1023,25 @@ if(NSMaxRange(theCharRange) > [[theView string] length]) theCharRange = NSIntersectionRange(NSMakeRange(0,[[theView string] length]), theCharRange); + [theView breakUndoCoalescing]; + NSRange r = [theView selectedRange]; if(r.length) [theView setSelectedRange:r]; else { - if(backtickMode) - [theView setSelectedRange:NSMakeRange(theCharRange.location, theCharRange.length+2)]; - else + if(backtickMode == 100) { + BOOL nextCharIsBacktick = ([[[theView string] substringWithRange:theCharRange] hasSuffix:@"`"]); + if(theCharRange.length == 1) nextCharIsBacktick = NO; + if(!nextCharIsBacktick) + [theView setSelectedRange:NSMakeRange(theCharRange.location, theCharRange.length+2)]; + else + [theView setSelectedRange:theCharRange]; + backtickMode = 0; + } else [theView setSelectedRange:theCharRange]; } + [theView breakUndoCoalescing]; [theView insertText:aString]; // If completion string contains backticks move caret out of the backticks @@ -1077,7 +1088,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 = 100; // suppress move the caret one step rightwards [self insert_text:[candidateMatch backtickQuotedString]]; } else { [self insert_text:candidateMatch]; |