diff options
Diffstat (limited to 'Source/SPTextView.m')
-rw-r--r-- | Source/SPTextView.m | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/Source/SPTextView.m b/Source/SPTextView.m index cb0e4d9e..65115813 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -27,6 +27,7 @@ #import "SPDatabaseDocument.h" #import "SPNarrowDownCompletion.h" #import "SPQueryController.h" +#import "SPQueryDocumentsController.h" #import "SPTooltip.h" #import "SPTablesList.h" #import "SPNavigatorController.h" @@ -234,22 +235,22 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) #ifndef SP_REFACTOR if ([keyPath isEqualToString:SPCustomQueryEditorBackgroundColor]) { [self setQueryEditorBackgroundColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]]; - [self setNeedsDisplay:YES]; + [self setNeedsDisplayInRect:[self bounds]]; } else if ([keyPath isEqualToString:SPCustomQueryEditorFont]) { [self setFont:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]]; - [self setNeedsDisplay:YES]; + [self setNeedsDisplayInRect:[self bounds]]; } else if ([keyPath isEqualToString:SPCustomQueryEditorHighlightQueryColor]) { [self setQueryHiliteColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]]; - [self setNeedsDisplay:YES]; + [self setNeedsDisplayInRect:[self bounds]]; } else if ([keyPath isEqualToString:SPCustomQueryEditorCaretColor]) { [self setInsertionPointColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]]; - [self setNeedsDisplay:YES]; + [self setNeedsDisplayInRect:[self bounds]]; } else if ([keyPath isEqualToString:SPCustomQueryEditorSelectionColor]) { [self setSelectedTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]], NSBackgroundColorAttributeName, nil]]; - [self setNeedsDisplay:YES]; + [self setNeedsDisplayInRect:[self bounds]]; } else if ([keyPath isEqualToString:SPCustomQueryHighlightCurrentQuery]) { [self setShouldHiliteQuery:[[change objectForKey:NSKeyValueChangeNewKey] boolValue]]; - [self setNeedsDisplay:YES]; + [self setNeedsDisplayInRect:[self bounds]]; } else if ([keyPath isEqualToString:SPCustomQueryEditorCommentColor]) { [self setCommentColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]]; if([[self string] length]<100000 && [self isEditable]) @@ -2714,7 +2715,7 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) end = strlength; } else { while(end < strlength && lengthChecker > 0) { - if([selfstr characterAtIndex:end]=='\n') + if(CFStringGetCharacterAtIndex((CFStringRef)selfstr, end)=='\n') break; end++; lengthChecker--; @@ -2735,7 +2736,7 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) lengthChecker = SP_SYNTAX_HILITE_BIAS; if (start > 0) while(start>0 && lengthChecker > 0) { - if([selfstr characterAtIndex:start]=='\n') + if(CFStringGetCharacterAtIndex((CFStringRef)selfstr, start)=='\n') break; start--; lengthChecker--; @@ -2757,6 +2758,8 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) textRange = NSMakeRange(0,strlength); } + // [textStore beginEditing]; + NSColor *tokenColor; size_t tokenEnd, token; @@ -2873,6 +2876,10 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) } + // [textStore endEditing]; + + [self setNeedsDisplayInRect:[self bounds]]; + } - (void) setTabStops @@ -3261,6 +3268,12 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) selector:@selector(doAutoCompletion) object:nil]; + // Cancel calling doSyntaxHighlighting for large text + if([[self string] length] > SP_TEXT_SIZE_TRIGGER_FOR_PARTLY_PARSING) + [NSObject cancelPreviousPerformRequestsWithTarget:self + selector:@selector(doSyntaxHighlighting) + object:nil]; + NSInteger editedMask = [textStore editedMask]; // Start autohelp only if the user really changed the text (not e.g. for setting a background color) @@ -3279,12 +3292,6 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) [self performSelector:@selector(doAutoCompletion) withObject:nil afterDelay:1.5]; #endif - // Cancel calling doSyntaxHighlighting for large text - if([[self string] length] > SP_TEXT_SIZE_TRIGGER_FOR_PARTLY_PARSING) - [NSObject cancelPreviousPerformRequestsWithTarget:self - selector:@selector(doSyntaxHighlighting) - object:nil]; - // Do syntax highlighting/re-calculate snippet ranges only if the user really changed the text if(editedMask != 1) { @@ -3612,7 +3619,7 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) [self setEditable:YES]; [self setFont:nf]; [self setEditable:oldEditable]; - [self setNeedsDisplay:YES]; + [self setNeedsDisplayInRect:[self bounds]]; [prefs setObject:[NSArchiver archivedDataWithRootObject:nf] forKey:SPCustomQueryEditorFont]; } #endif |