aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMTextView.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-02-02 14:31:25 +0000
committerBibiko <bibiko@eva.mpg.de>2010-02-02 14:31:25 +0000
commit736c95f11116e0be3e516933506034fb6078be72 (patch)
tree846858d08b0c86e8c21ad13c1487db80f5773ea7 /Source/CMTextView.m
parent9084465bbcd453cb2f433917c23d2bf4da65db08 (diff)
downloadsequelpro-736c95f11116e0be3e516933506034fb6078be72.tar.gz
sequelpro-736c95f11116e0be3e516933506034fb6078be72.tar.bz2
sequelpro-736c95f11116e0be3e516933506034fb6078be72.zip
• CMTextView
- suppress current query/syntax highlighting for text buffer size > 20MB to allow at least editing and performing queries • Main Menu - set hidden new Export menu item to key ⇧⌘E and reset "Use selection for searching" to ⌘E since it's a standard Mac binding
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r--Source/CMTextView.m5
1 files changed, 4 insertions, 1 deletions
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]