From 9f431c3e9faf9c1d6a66d192e5405203f65ca77c Mon Sep 17 00:00:00 2001 From: Bibiko Date: Sat, 6 Jun 2009 11:58:32 +0000 Subject: =?UTF-8?q?=E2=80=A2=20improved:=20sped=20up=20removing=20the=20ba?= =?UTF-8?q?ckground=20color=20for=20query=20highlighting=20=E2=80=A2=20add?= =?UTF-8?q?ed:=20DELIMITER=20to=20the=20completion=20suggestions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CMTextView.m | 3 +++ Source/CustomQuery.m | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'Source') diff --git a/Source/CMTextView.m b/Source/CMTextView.m index a6f7cabc..d15a9f5b 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -1180,6 +1180,9 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) @"DELAYED", @"DELAY_KEY_WRITE", @"DELETE", + @"DELIMITER ", + @"DELIMITER ;\n", + @"DELIMITER ;;\n", @"DESC", @"DESCRIBE", @"DES_KEY_FILE", diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 4d1d684d..26888225 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -1267,9 +1267,15 @@ // Ensure that the notification is from the custom query text view if ( [aNotification object] != textView ) return; - // Remove all background color attributes for highlighting the current query + // Remove all background color attributes used by highlighting the current query if([prefs boolForKey:@"CustomQueryHighlightCurrentQuery"]) { - [[textView textStorage] removeAttribute:NSBackgroundColorAttributeName range:NSMakeRange(0,[[textView string] length])]; + // Remove only the background attribute for the current range if still valid + NSRange textRange = NSMakeRange(0,[[textView string] length]); + NSRange r = NSIntersectionRange(currentQueryRange, textRange); + if(r.length) + [[textView textStorage] removeAttribute:NSBackgroundColorAttributeName range:r]; + else + [[textView textStorage] removeAttribute:NSBackgroundColorAttributeName range:textRange]; } else { // ensure that we do it only once if(hasBackgroundAttribute) { -- cgit v1.2.3