diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMTextView.m | 24 | ||||
-rw-r--r-- | Source/CustomQuery.m | 5 |
2 files changed, 15 insertions, 14 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m index b64c07a0..4b42d009 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -169,13 +169,11 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) // If caret is not inside backticks add keywords and all words coming from the view. if(!dbBrowseMode) { - // Only parse for words if text size is less than 6MB - if([[self string] length] && [[self string] length]<6000000) + // Only parse for words if text size is less than 60kB + if([[self string] length] && [[self string] length]<60000) { - NSCharacterSet *separators = [NSCharacterSet characterSetWithCharactersInString:@" \t\r\n,()[]{}\"'`-!;=+|?:~@."]; - NSMutableArray *uniqueArray = [NSMutableArray array]; - [uniqueArray addObjectsFromArray:[[NSSet setWithArray:[[self string] componentsSeparatedByCharactersInSet:separators]] allObjects]]; + [uniqueArray addObjectsFromArray:[NSSet setWithArray:[[self string] componentsMatchedByRegex:@"\\w+"]]]; // Remove current word from list [uniqueArray removeObject:currentWord]; @@ -397,6 +395,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) // No completion for a selection (yet?) and if caret positiopn == 0 if([self selectedRange].length > 0 || ![self selectedRange].location) return; + [self breakUndoCoalescing]; + NSInteger caretPos = [self selectedRange].location; BOOL caretMovedLeft = NO; @@ -431,6 +431,11 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) NSInteger backtickMode = 0; // 0 none, 1 rigth only, 2 left only, 3 both BOOL caseInsensitive = YES; + // Remove that attribute to suppress auto-uppercasing of certain keyword combinations + if(![self selectedRange].length && [self selectedRange].location) + [[self textStorage] removeAttribute:kSQLkeyword range:completionRange]; + + if(!isDictMode) { // Parse for leading db.table.field infos @@ -822,22 +827,15 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) unichar insertedCharacter = [characters characterAtIndex:0]; long curFlags = ([theEvent modifierFlags] & allFlags); - if ([theEvent keyCode] == 53){ // ESC key for internal completion - [self breakUndoCoalescing]; + if ([theEvent keyCode] == 53 && [self isEditable]){ // ESC key for internal completion 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]]; return; } if (insertedCharacter == NSF5FunctionKey){ // F5 for completion based on spell checker [self doCompletionByUsingSpellChecker:YES 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]]; return; } diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 62deb15d..b536491b 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -283,7 +283,10 @@ // "Completion List" menu item - used to autocomplete. Uses a different shortcut to avoid the menu button flickering // on normal autocomplete usage. if (sender == completionListMenuItem) { - [textView complete:self]; + if([[NSApp currentEvent] modifierFlags] & (NSControlKeyMask)) + [textView doCompletionByUsingSpellChecker:NO fuzzyMode:YES]; + else + [textView doCompletionByUsingSpellChecker:NO fuzzyMode:NO]; } // "Editor font..." menu item to bring up the font panel |