diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-01-25 14:44:00 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-01-25 14:44:00 +0000 |
commit | fcc453852ad3693590d42fedfe5280e74948cd0b (patch) | |
tree | c5adece69674488b3eac311c0c3fd49770522854 /Source/SPNarrowDownCompletion.m | |
parent | aca8fe1c4b23148e21d38f1e06969510bb9a8257 (diff) | |
download | sequelpro-fcc453852ad3693590d42fedfe5280e74948cd0b.tar.gz sequelpro-fcc453852ad3693590d42fedfe5280e74948cd0b.tar.bz2 sequelpro-fcc453852ad3693590d42fedfe5280e74948cd0b.zip |
• further improvements to allow to insert programmable query favorites (as snippets) - not yet finished but workable eg fav:
"SELECT ${1:`mysql`.`user`.} FROM ${2:`mysql`.`user`} ${3:WHERE}" bound to tab trigger "sel"; then write "sel" press ⇥ to expand, change `mysql`.`user`. or press ESC to insert a field, press ⇥ to select `mysql`.`user`to change if desired, etc. or press ⇧⇥ to select prev. snippet
• completion can now be invoked via selection
- some other tiny improvements
Diffstat (limited to 'Source/SPNarrowDownCompletion.m')
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index cc941924..a48aa204 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -132,7 +132,7 @@ - (id)initWithItems:(NSArray*)someSuggestions alreadyTyped:(NSString*)aUserString staticPrefix:(NSString*)aStaticPrefix additionalWordCharacters:(NSString*)someAdditionalWordCharacters caseSensitive:(BOOL)isCaseSensitive charRange:(NSRange)initRange parseRange:(NSRange)parseRange inView:(id)aView - dictMode:(BOOL)mode dbMode:(BOOL)theDbMode fuzzySearch:(BOOL)fuzzySearch + 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 { @@ -153,6 +153,7 @@ cursorMovedLeft = caretMovedLeft; backtickMode = theBackTickMode; commaInsertionMode = NO; + triggerMode = tabTriggerMode; if(aStaticPrefix) staticPrefix = [aStaticPrefix retain]; @@ -546,6 +547,7 @@ [theTableView setBackgroundColor:[NSColor colorWithCalibratedRed:0.9f green:0.9f blue:0.9f alpha:1.0f]]; [self filter]; } else { + if(cursorMovedLeft) [theView performSelector:@selector(moveRight:)]; break; } } @@ -580,6 +582,7 @@ else { [NSApp sendEvent:event]; + if(cursorMovedLeft) [theView performSelector:@selector(moveRight:)]; break; } } @@ -589,8 +592,10 @@ [self completeAndInsertSnippet]; } else { [NSApp sendEvent:event]; - if(!NSPointInRect([NSEvent mouseLocation], [self frame])) + if(!NSPointInRect([NSEvent mouseLocation], [self frame])) { + if(cursorMovedLeft) [theView performSelector:@selector(moveRight:)]; break; + } } } else @@ -598,7 +603,6 @@ [NSApp sendEvent:event]; } } - if(cursorMovedLeft) [theView performSelector:@selector(moveRight:)]; [self close]; usleep(70); // tiny delay to suppress while continously pressing of ESC overlapping } @@ -647,7 +651,7 @@ [theView setSelectedRange:theCharRange]; [theView insertText:aString]; // If completion string contains backticks move caret out of the backticks - if(backtickMode) + if(backtickMode && !triggerMode) [theView performSelector:@selector(moveRight:)]; } |