aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMTextView.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-01-21 10:15:31 +0000
committerBibiko <bibiko@eva.mpg.de>2010-01-21 10:15:31 +0000
commitbc01bc7bcfe8b332ffa638c0f89adb8f2e5f748a (patch)
tree31d2fa5a23313578b7bcd5bde47591c4fc0d01de /Source/CMTextView.m
parentce340132e43b5f0d90286704d1232f77f6ffbc8a (diff)
downloadsequelpro-bc01bc7bcfe8b332ffa638c0f89adb8f2e5f748a.tar.gz
sequelpro-bc01bc7bcfe8b332ffa638c0f89adb8f2e5f748a.tar.bz2
sequelpro-bc01bc7bcfe8b332ffa638c0f89adb8f2e5f748a.zip
• completion
- CTRL+ESC invokes the fuzzy search completion; eg: i_s.pcss. will show all fields from `information_schema`.`PROCESSLIST`. if no other matches are found; the search is a regexp ".*?i.*?_.*?s.*?\. …" etc. by using RegexKitLite which is much more faster than NSPredicate and can handle long regexps - improved type display: if a type definition contains a , split it to avoid splitting of the tokenFields - while insertion of an item and holding down the CTRL key the list keeps open to allow to insert more suggestions separated by ", " from the current list (very useful if one wants to insert only selected fields from a table)
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r--Source/CMTextView.m13
1 files changed, 7 insertions, 6 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 1cceac97..7378253a 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -304,7 +304,9 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
for(id field in sortedFields) {
if(![field hasPrefix:@" "]) {
NSString *typ = [theTable objectForKey:field];
- if(typ && [typ hasPrefix:@"set("] || [typ hasPrefix:@"enum("]) {
+ // Check if type definition contains a , if so replace the bracket content by … and add
+ // the bracket content as "list" key to prevend the token field to split them by ,
+ if(typ && [typ rangeOfString:@","].length) {
NSString *t = [typ stringByReplacingOccurrencesOfRegex:@"\\(.*?\\)" withString:@"(…)"];
NSString *lst = [typ stringByMatching:@"\\(([^\\)]*?)\\)" capture:1L];
[possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@@ -541,7 +543,6 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if(fuzzySearch) {
filter = [[NSString stringWithString:[[self string] substringWithRange:parseRange]] stringByReplacingOccurrencesOfString:@"`" withString:@""];
- if([filter length]>15) return;
completionRange = parseRange;
}
@@ -814,10 +815,10 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
long curFlags = ([theEvent modifierFlags] & allFlags);
if ([theEvent keyCode] == 53){ // ESC key for internal completion
- // if(curFlags==(NSControlKeyMask))
- // [self doCompletionByUsingSpellChecker:NO fuzzyMode:YES];
- // else
- [self doCompletionByUsingSpellChecker:NO fuzzyMode:NO];
+ if(curFlags==(NSControlKeyMask))
+ [self doCompletionByUsingSpellChecker:NO fuzzyMode:YES];
+ else
+ [self doCompletionByUsingSpellChecker:NO fuzzyMode:NO];
// Remove that attribute to suppress auto-uppercasing of certain keyword combinations
if(![self selectedRange].length && [self selectedRange].location)
[[self textStorage] removeAttribute:kSQLkeyword range:[self getRangeForCurrentWord]];