From 1043c60fb5f69a25ca429051f90e53489feab715 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 19 May 2009 17:42:02 +0000 Subject: =?UTF-8?q?=E2=80=A2=20improved=20"Update=20Help=20while=20typing"?= =?UTF-8?q?=20-=20it=20recognizes=20any=20keyDown=20event=20including=20ar?= =?UTF-8?q?row=20keys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CMTextView.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Source/CMTextView.m') diff --git a/Source/CMTextView.m b/Source/CMTextView.m index e7e0c46f..9a25dfd8 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -280,10 +280,13 @@ YY_BUFFER_STATE yy_scan_string (const char *); - (void) keyDown:(NSEvent *)theEvent { - if([prefs boolForKey:@"CustomQueryAutohelp"]) // cancel autoHelp request + if([prefs boolForKey:@"CustomQueryAutohelp"]) {// restart autoHelp timer [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(autoHelp) object:nil]; + [self performSelector:@selector(autoHelp) withObject:nil + afterDelay:[[[prefs valueForKey:@"CustomQueryAutohelpDelay"] retain] floatValue]]; + } long allFlags = (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask); @@ -446,8 +449,6 @@ YY_BUFFER_STATE yy_scan_string (const char *); // The default action is to perform the normal key-down action. [super keyDown:theEvent]; - if([prefs boolForKey:@"CustomQueryAutohelp"]) - [self performSelector:@selector(autoHelp) withObject:nil afterDelay:[[[prefs valueForKey:@"CustomQueryAutohelpDelay"] retain] floatValue]]; } @@ -1778,8 +1779,9 @@ YY_BUFFER_STATE yy_scan_string (const char *); */ - (void)autoHelp { + if(![prefs boolForKey:@"CustomQueryAutohelp"]) return; - + // If selection show Help for it if([self selectedRange].length) { @@ -2068,6 +2070,9 @@ YY_BUFFER_STATE yy_scan_string (const char *); //make sure that the notification is from the correct textStorage object if (textStore!=[self textStorage]) return; + if([prefs boolForKey:@"CustomQueryAutohelp"]) + [self performSelector:@selector(autoHelp) withObject:nil afterDelay:[[[prefs valueForKey:@"CustomQueryAutohelpDelay"] retain] floatValue]]; + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(doSyntaxHighlighting) object:nil]; -- cgit v1.2.3