aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-02-05 21:23:20 +0000
committerBibiko <bibiko@eva.mpg.de>2010-02-05 21:23:20 +0000
commitcc40f75fbe1896eb69d84a8f00ed20b6bb70bd28 (patch)
treea66b732fe357db5e3231550d680360758f6a12e1 /Source
parentbd69a9eccea56335422d13b8eddbd2aec79c839f (diff)
downloadsequelpro-cc40f75fbe1896eb69d84a8f00ed20b6bb70bd28.tar.gz
sequelpro-cc40f75fbe1896eb69d84a8f00ed20b6bb70bd28.tar.bz2
sequelpro-cc40f75fbe1896eb69d84a8f00ed20b6bb70bd28.zip
• improved completion behaviour of suggestions containing spaces; a second space will cancel the list to allow a more natural typing
Diffstat (limited to 'Source')
-rw-r--r--Source/SPNarrowDownCompletion.h1
-rw-r--r--Source/SPNarrowDownCompletion.m16
2 files changed, 12 insertions, 5 deletions
diff --git a/Source/SPNarrowDownCompletion.h b/Source/SPNarrowDownCompletion.h
index de4e7a06..96558b9d 100644
--- a/Source/SPNarrowDownCompletion.h
+++ b/Source/SPNarrowDownCompletion.h
@@ -58,6 +58,7 @@
id theView;
NSInteger maxWindowWidth;
+ NSInteger spaceCounter;
NSMutableCharacterSet* textualInputCharacters;
}
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m
index a48aa204..3b108de6 100644
--- a/Source/SPNarrowDownCompletion.m
+++ b/Source/SPNarrowDownCompletion.m
@@ -109,6 +109,7 @@
textualInputCharacters = [[NSMutableCharacterSet alphanumericCharacterSet] retain];
caseSensitive = YES;
filtered = nil;
+ spaceCounter = 0;
tableFont = [NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] dataForKey:SPCustomQueryEditorFont]];
[self setupInterface];
@@ -369,12 +370,13 @@
- (void)checkSpaceForAllowedCharacter
{
[textualInputCharacters removeCharactersInString:@" "];
- for(id w in filtered){
- if([[w objectForKey:@"match"] ?: [w objectForKey:@"display"] rangeOfString:@" "].length) {
- [textualInputCharacters addCharactersInString:@" "];
- break;
+ if(spaceCounter < 1)
+ for(id w in filtered){
+ if([[w objectForKey:@"match"] ?: [w objectForKey:@"display"] rangeOfString:@" "].length) {
+ [textualInputCharacters addCharactersInString:@" "];
+ break;
+ }
}
- }
}
// ====================
@@ -561,6 +563,7 @@
if([mutablePrefix length] == 0 || commaInsertionMode)
break;
+ spaceCounter = 0;
[mutablePrefix deleteCharactersInRange:NSMakeRange([mutablePrefix length]-1, 1)];
theCharRange.length--;
theParseRange.length--;
@@ -572,12 +575,15 @@
if(commaInsertionMode)
break;
+ if([event keyCode] == 49) // space
+ spaceCounter++;
[mutablePrefix appendString:[event characters]];
theCharRange.length++;
theParseRange.length++;
[self filter];
[self insertCommonPrefix];
+
}
else
{