diff options
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r-- | Source/CMTextView.m | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m index eb2abff4..cadd71c4 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -1125,6 +1125,15 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) } +/* + * Return YES if user interacts with snippets (is needed mainly for suppressing + * the highlighting of the current query) + */ +- (BOOL)isSnippetMode +{ + return (snippetControlCounter > -1) ? YES : NO; +} + #pragma mark - #pragma mark event management @@ -2865,24 +2874,28 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) - (void)drawRect:(NSRect)rect { - [super drawRect:rect]; - // Highlight snippets coming from the Query Favorite text macro if(snippetControlCounter > -1) { NSInteger i; - [[NSColor colorWithCalibratedRed:0.0 green:0.5 blue:0.0 alpha:0.1] setFill]; for(i=0; i<snippetControlMax; i++) { if(snippetControlArray[i][0] > -1) { NSRange glRange = [[self layoutManager] glyphRangeForCharacterRange:NSMakeRange(snippetControlArray[i][0],snippetControlArray[i][1]) actualCharacterRange:NULL]; if(glRange.length) { NSRect boundingRect = [[self layoutManager] boundingRectForGlyphRange:glRange inTextContainer:[self textContainer]]; - boundingRect = NSInsetRect(boundingRect, 0, 2); - NSBezierPath *aBezierPath = [NSBezierPath bezierPathWithRoundedRect:boundingRect xRadius:4 yRadius:15]; + boundingRect = NSInsetRect(boundingRect, -4, -1); + NSBezierPath *aBezierPath = [NSBezierPath bezierPathWithRoundedRect:boundingRect xRadius:5 yRadius:10]; + [[NSColor colorWithCalibratedRed:1.0 green:1. blue:0.0 alpha:0.4] setFill]; + [aBezierPath fill]; + boundingRect = NSInsetRect(boundingRect, 2, 2); + aBezierPath = [NSBezierPath bezierPathWithRoundedRect:boundingRect xRadius:5 yRadius:10]; + [[NSColor colorWithCalibratedRed:1.0 green:1. blue:1.0 alpha:0.8] setFill]; [aBezierPath fill]; } } } } + [super drawRect:rect]; + } @@ -3051,7 +3064,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) NSInteger changeInLength = [textStore changeInLength]; NSInteger i; - // Remove any fully nested snippets relative to the current snippet which is was edited + // Remove any fully nested snippets relative to the current snippet which was edited if(snippetControlArray[i][0] > -1 && i != snippetControlMax) { NSInteger currentSnippetLocation = snippetControlArray[currentSnippetIndex][0]; NSInteger currentSnippetMaxRange = snippetControlArray[currentSnippetIndex][0] + snippetControlArray[currentSnippetIndex][1]; |