diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-01-10 00:12:10 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-01-10 00:12:10 +0000 |
commit | 602633c84982f4e8061cde8a3cb09ada6c4d11bf (patch) | |
tree | 2e8745f819c54750e23ab3484ec647407ede2362 /Source/SPNarrowDownCompletion.m | |
parent | a252c9efe5f22cbdc8dd8343c7e2a6c631add785 (diff) | |
download | sequelpro-602633c84982f4e8061cde8a3cb09ada6c4d11bf.tar.gz sequelpro-602633c84982f4e8061cde8a3cb09ada6c4d11bf.tar.bz2 sequelpro-602633c84982f4e8061cde8a3cb09ada6c4d11bf.zip |
• made lexer 64bit compatible
- 'int' has to be replaced by 'size_t'
• F5 completion
- if inside of backticks after completion move caret one char rightwards to go out of the backticks
Diffstat (limited to 'Source/SPNarrowDownCompletion.m')
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index a4daefa0..090319dc 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -124,19 +124,30 @@ [super dealloc]; } -- (id)initWithItems:(NSArray*)someSuggestions alreadyTyped:(NSString*)aUserString staticPrefix:(NSString*)aStaticPrefix additionalWordCharacters:(NSString*)someAdditionalWordCharacters caseSensitive:(BOOL)isCaseSensitive charRange:(NSRange)initRange inView:(id)aView dictMode:(BOOL)mode +- (id)initWithItems:(NSArray*)someSuggestions alreadyTyped:(NSString*)aUserString staticPrefix:(NSString*)aStaticPrefix additionalWordCharacters:(NSString*)someAdditionalWordCharacters caseSensitive:(BOOL)isCaseSensitive charRange:(NSRange)initRange inView:(id)aView dictMode:(BOOL)mode dbMode:(BOOL)dbMode { if(self = [self init]) { - if(aUserString && ![aUserString isEqualToString:@"`"]) + BOOL filterStringIsBacktick = ([aUserString isEqualToString:@"`"]) ? YES : NO; + + // Set filter string - if aUserString == ` user invoked it via `|` ie show all db/tables/fields etc. + if(aUserString && !filterStringIsBacktick) [mutablePrefix appendString:aUserString]; + dbStructureMode = dbMode; + if(aStaticPrefix) staticPrefix = [aStaticPrefix retain]; caseSensitive = isCaseSensitive; + theCharRange = initRange; + if(filterStringIsBacktick) { + theCharRange.length = 0; + theCharRange.location++; + } + theView = aView; dictMode = mode; @@ -474,7 +485,9 @@ if([[self filterString] length] < [commonPrefix length]) { - [self insert_text:commonPrefix]; + [theView setSelectedRange:theCharRange]; + [theView insertText:commonPrefix]; + NSString* toInsert = [commonPrefix substringFromIndex:[[self filterString] length]]; [mutablePrefix appendString:toInsert]; theCharRange = NSMakeRange(theCharRange.location,[commonPrefix length]); @@ -491,6 +504,8 @@ { [theView setSelectedRange:theCharRange]; [theView insertText:aString]; + if(dbStructureMode) + [theView performSelector:@selector(moveRight:)]; } - (void)completeAndInsertSnippet @@ -505,6 +520,7 @@ NSString* candidateMatch = [selectedItem objectForKey:@"match"] ?: [selectedItem objectForKey:@"display"]; if([[self filterString] length] < [candidateMatch length]) [self insert_text:candidateMatch]; + } closeMe = YES; } |