From 736c95f11116e0be3e516933506034fb6078be72 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 2 Feb 2010 14:31:25 +0000 Subject: =?UTF-8?q?=E2=80=A2=20CMTextView=20-=20suppress=20current=20query?= =?UTF-8?q?/syntax=20highlighting=20for=20text=20buffer=20size=20>=2020MB?= =?UTF-8?q?=20to=20allow=20at=20least=20editing=20and=20performing=20queri?= =?UTF-8?q?es=20=E2=80=A2=20Main=20Menu=20-=20set=20hidden=20new=20Export?= =?UTF-8?q?=20menu=20item=20to=20key=20=E2=87=A7=E2=8C=98E=20and=20reset?= =?UTF-8?q?=20"Use=20selection=20for=20searching"=20to=20=E2=8C=98E=20sinc?= =?UTF-8?q?e=20it's=20a=20standard=20Mac=20binding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CMTextView.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Source/CMTextView.m') diff --git a/Source/CMTextView.m b/Source/CMTextView.m index c2aac5cf..d9ba59f4 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -67,6 +67,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); #define SP_CQ_SELECT_CURRENT_QUERY_MENU_ITEM_TAG 1002 #define SP_SYNTAX_HILITE_BIAS 2000 +#define SP_MAX_TEXT_SIZE_FOR_SYNTAX_HIGHLIGHTING 20000000 #define MYSQL_DOC_SEARCH_URL @"http://dev.mysql.com/doc/refman/%@/en/%@.html" @@ -2792,6 +2793,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) NSString *selfstr = [self string]; NSUInteger strlength = [selfstr length]; + if(strlength > SP_MAX_TEXT_SIZE_FOR_SYNTAX_HIGHLIGHTING) return; + NSRange textRange; // If text larger than SP_TEXT_SIZE_TRIGGER_FOR_PARTLY_PARSING @@ -2990,7 +2993,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) // Highlightes the current query if set in the Pref and no snippet session // and if nothing is selected in the text view - if ([self shouldHiliteQuery] && snippetControlCounter<=-1 && ![self selectedRange].length) { + if ([self shouldHiliteQuery] && snippetControlCounter<=-1 && ![self selectedRange].length && [[self string] length] < SP_MAX_TEXT_SIZE_FOR_SYNTAX_HIGHLIGHTING) { NSUInteger rectCount; [[self textStorage] ensureAttributesAreFixedInRange:[self queryRange]]; NSRectArray queryRects = [[self layoutManager] rectArrayForCharacterRange: [self queryRange] -- cgit v1.2.3