From 6d3980063a2a37d7c3310a9808312b358ebdb2d3 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 4 Jun 2009 17:42:04 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed:=20suppress=20highlighting=20of=20the?= =?UTF-8?q?=20current=20query=20if=20something=20is=20selected=20=E2=80=A2?= =?UTF-8?q?=20added:=20"Select=20Active=20Query=20^Y"=20context=20menu=20i?= =?UTF-8?q?tem=20to=20the=20Custom=20Query=20Editor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CustomQuery.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Source/CustomQuery.m') diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index cbb9a38c..63a1efd4 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -818,6 +818,11 @@ return (queryRange.length) ? [[textView string] substringWithRange:queryRange] : nil; } +- (void)selectCurrentQuery +{ + if(currentQueryRange.length) + [textView setSelectedRange:currentQueryRange]; +} #pragma mark - #pragma mark Accessors @@ -1245,7 +1250,8 @@ NSRange qRange = [self queryRangeAtPosition:caretPosition lookBehind:&isLookBehind]; // Highlight by setting a background color the current query - if(qRange.length) { + // if nothing is selected + if(qRange.length && !currentSelection.length) { [[textView textStorage] addAttribute: NSBackgroundColorAttributeName value: [NSColor colorWithDeviceRed:0.95 green:0.95 blue:0.95 alpha:1] range: qRange ]; -- cgit v1.2.3