aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTextView.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-08-16 15:15:27 +0000
committerBibiko <bibiko@eva.mpg.de>2010-08-16 15:15:27 +0000
commit37e7a952eebd25515bb3ee9d85898a5a984f9d21 (patch)
tree4a6ba0e364be3b58d2e008444b7579b1083c3fac /Source/SPTextView.m
parent31783f3e83e337447a04ccefb4a7d7acdb15083b (diff)
downloadsequelpro-37e7a952eebd25515bb3ee9d85898a5a984f9d21.tar.gz
sequelpro-37e7a952eebd25515bb3ee9d85898a5a984f9d21.tar.bz2
sequelpro-37e7a952eebd25515bb3ee9d85898a5a984f9d21.zip
• auto-completion in Query Editor now detects whether the caret is inside quotes or not in order to come up with the correct suggestions
Diffstat (limited to 'Source/SPTextView.m')
-rw-r--r--Source/SPTextView.m9
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/SPTextView.m b/Source/SPTextView.m
index 9501992a..32547627 100644
--- a/Source/SPTextView.m
+++ b/Source/SPTextView.m
@@ -549,8 +549,15 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Suppress auto-completion if the window isn't active anymore
if ([[NSApp keyWindow] firstResponder] != self) return;
+ BOOL useSpellChecker = NO;
+
+ // Check if caret is inside a quote to auto-complete by using spellChecker
+ NSColor *currentCharColor = [[self textStorage] attribute:NSForegroundColorAttributeName atIndex:r.location-1 effectiveRange:nil];
+ if(currentCharColor && currentCharColor == quoteColor)
+ useSpellChecker = YES;
+
// Trigger the completion
- [self doCompletionByUsingSpellChecker:NO fuzzyMode:NO autoCompleteMode:YES];
+ [self doCompletionByUsingSpellChecker:useSpellChecker fuzzyMode:NO autoCompleteMode:YES];
}
}