aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMTextView.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-07-15 10:12:34 +0000
committerBibiko <bibiko@eva.mpg.de>2009-07-15 10:12:34 +0000
commit3a0743df3ea4272f90b65e43799f3d9d86ed415a (patch)
tree65d38bad88fea5be2d7ac5de66e3a49c95aaf033 /Source/CMTextView.m
parenta1f15a4aff3e32817faa5b237f4d1febd3bc4410 (diff)
downloadsequelpro-3a0743df3ea4272f90b65e43799f3d9d86ed415a.tar.gz
sequelpro-3a0743df3ea4272f90b65e43799f3d9d86ed415a.tar.bz2
sequelpro-3a0743df3ea4272f90b65e43799f3d9d86ed415a.zip
• fixed dealloc of 'suggestions' in SPNarrowDownCompletion
• deleted (void)paste hook from CMTextView (not needed anymore) • decreased iteration cycles for 'normal' completion (ESC) by getting only the unique words from the current textView
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r--Source/CMTextView.m26
1 files changed, 11 insertions, 15 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index dbd33342..ecca0721 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -915,12 +915,20 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if(![[[self textStorage] attribute:kBTQuote atIndex:charRange.location effectiveRange:nil] isEqualToString:kBTQuoteValue] )
{
// Only parse for words if text size is less than 6MB
+ // if([[self string] length]<6000000)
+ // {
+ // NSCharacterSet *separators = [NSCharacterSet characterSetWithCharactersInString:@" \t\r\n,()\"'`-!;=+|?:~@"];
+ // NSArray *textViewWords = [[self string] componentsSeparatedByCharactersInSet:separators];
+ // [possibleCompletions addObjectsFromArray:textViewWords];
+ // }
if([[self string] length]<6000000)
{
- NSCharacterSet *separators = [NSCharacterSet characterSetWithCharactersInString:@" \t\r\n,()\"'`-!;=+|?:~@"];
- NSArray *textViewWords = [[self string] componentsSeparatedByCharactersInSet:separators];
- [possibleCompletions addObjectsFromArray:textViewWords];
+ NSCharacterSet *separators = [NSCharacterSet characterSetWithCharactersInString:@" \t\r\n,()[]{}\"'`-!;=+|?:~@"];
+ NSMutableArray *uniqueArray = [NSMutableArray array];
+ [uniqueArray addObjectsFromArray:[[NSSet setWithArray:[[self string] componentsSeparatedByCharactersInSet:separators]] allObjects]];
+ [possibleCompletions addObjectsFromArray:uniqueArray];
}
+
[possibleCompletions addObjectsFromArray:[self keywords]];
}
@@ -946,18 +954,6 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
/*
- * Hook to invoke the auto-uppercasing of SQL keywords after pasting
- */
-- (void)paste:(id)sender
-{
-
- [super paste:sender];
- // Invoke the auto-uppercasing of SQL keywords via an additional trigger
- [self insertText:@""];
-}
-
-
-/*
* List of keywords for autocompletion. If you add a keyword here,
* it should also be added to the flex file SPEditorTokens.l
*/