diff options
-rw-r--r-- | Source/CMTextView.m | 5 | ||||
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 4 | ||||
-rw-r--r-- | Source/TableDocument.m | 11 |
3 files changed, 16 insertions, 4 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 91be7257..004eea93 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -519,13 +519,14 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) - (void) doAutoCompletion { + if(completionIsOpen || !self || ![self delegate]) return; + // Cancel autocompletion trigger if([prefs boolForKey:SPCustomQueryAutoComplete]) [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(doAutoCompletion) object:nil]; - if(completionIsOpen) return; NSRange r = [self selectedRange]; @@ -539,6 +540,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) if([[NSApp keyWindow] firstResponder] == self) [self doCompletionByUsingSpellChecker:NO fuzzyMode:NO autoCompleteMode:YES]; } + } - (void) doCompletionByUsingSpellChecker:(BOOL)isDictMode fuzzyMode:(BOOL)fuzzySearch autoCompleteMode:(BOOL)autoCompleteMode @@ -3280,7 +3282,6 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) selector:@selector(doAutoCompletion) object:nil]; - // Remove observers [[NSNotificationCenter defaultCenter] removeObserver:self]; [prefs removeObserver:self forKeyPath:SPCustomQueryEditorFont]; diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index 287fe98d..bfe3db99 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -165,8 +165,8 @@ [stateTimer release]; stateTimer = nil; if(syncArrowImages) [syncArrowImages release]; - usleep(1000); - [self performSelectorOnMainThread:@selector(reInvokeCompletion) withObject:nil waitUntilDone:NO]; + [self performSelectorOnMainThread:@selector(reInvokeCompletion) withObject:nil waitUntilDone:YES]; + closeMe = YES; return; } } diff --git a/Source/TableDocument.m b/Source/TableDocument.m index b2da29af..e850f443 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -3691,6 +3691,17 @@ - (void)windowWillClose:(NSNotification *)aNotification { + // Cancel autocompletion trigger + if([prefs boolForKey:SPCustomQueryAutoComplete]) + [NSObject cancelPreviousPerformRequestsWithTarget:[customQueryInstance valueForKeyPath:@"textView"] + selector:@selector(doAutoCompletion) + object:nil]; + if([prefs boolForKey:SPCustomQueryUpdateAutoHelp]) + [NSObject cancelPreviousPerformRequestsWithTarget:[customQueryInstance valueForKeyPath:@"textView"] + selector:@selector(autoHelp) + object:nil]; + + [[SPNavigatorController sharedNavigatorController] removeConnection:[self connectionID]]; [mySQLConnection setDelegate:nil]; |