Skip to content
Snippets Groups Projects
Commit 272920d1 authored by George Nachman's avatar George Nachman
Browse files

Highlight mark in red if it has an error code. Issue 4504.

parent 71233450
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3736,7 +3736,7 @@ ITERM_WEAKLY_REFERENCEABLE
self.currentMarkOrNotePosition = mark.entry.interval;
offset += [_screen totalScrollbackOverflow];
[_textview scrollToAbsoluteOffset:offset height:[_screen height]];
[_textview highlightMarkOnLine:VT100GridRangeMax(range)];
[_textview highlightMarkOnLine:VT100GridRangeMax(range) hasErrorCode:NO];
}
}
 
Loading
Loading
@@ -4157,7 +4157,13 @@ ITERM_WEAKLY_REFERENCEABLE
 
- (void)highlightMarkOrNote:(id<IntervalTreeObject>)obj {
if ([obj isKindOfClass:[iTermMark class]]) {
[_textview highlightMarkOnLine:VT100GridRangeMax([_screen lineNumberRangeOfInterval:obj.entry.interval])];
BOOL hasErrorCode = NO;
if ([obj isKindOfClass:[VT100ScreenMark class]]) {
VT100ScreenMark *mark = (VT100ScreenMark *)obj;
hasErrorCode = mark.code != 0;
}
[_textview highlightMarkOnLine:VT100GridRangeMax([_screen lineNumberRangeOfInterval:obj.entry.interval])
hasErrorCode:hasErrorCode];
} else {
PTYNoteViewController *note = (PTYNoteViewController *)obj;
[note setNoteHidden:NO];
Loading
Loading
Loading
Loading
@@ -441,7 +441,7 @@ typedef void (^PTYTextViewDrawingHookBlock)(iTermTextDrawingHelper *);
- (void)updateNoteViewFrames;
 
// Show a visual highlight of a mark on the given line number.
- (void)highlightMarkOnLine:(int)line;
- (void)highlightMarkOnLine:(int)line hasErrorCode:(BOOL)hasErrorCode;
 
- (IBAction)installShellIntegration:(id)sender;
 
Loading
Loading
Loading
Loading
@@ -5254,23 +5254,23 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
}
}
 
- (void)highlightMarkOnLine:(int)line {
- (void)highlightMarkOnLine:(int)line hasErrorCode:(BOOL)hasErrorCode {
CGFloat y = line * _lineHeight;
NSView *blue = [[[NSView alloc] initWithFrame:NSMakeRect(0, y, self.frame.size.width, _lineHeight)] autorelease];
[blue setWantsLayer:YES];
[self addSubview:blue];
NSView *highlightingView = [[[NSView alloc] initWithFrame:NSMakeRect(0, y, self.frame.size.width, _lineHeight)] autorelease];
[highlightingView setWantsLayer:YES];
[self addSubview:highlightingView];
 
// Set up layer's initial state
blue.layer.backgroundColor = [[NSColor blueColor] CGColor];
blue.layer.opaque = NO;
blue.layer.opacity = 0.75;
highlightingView.layer.backgroundColor = hasErrorCode ? [[NSColor redColor] CGColor] : [[NSColor blueColor] CGColor];
highlightingView.layer.opaque = NO;
highlightingView.layer.opacity = 0.75;
 
// Animate it out, removing from superview when complete.
[CATransaction begin];
[blue retain];
[highlightingView retain];
[CATransaction setCompletionBlock:^{
[blue removeFromSuperview];
[blue release];
[highlightingView removeFromSuperview];
[highlightingView release];
}];
const NSTimeInterval duration = 0.75;
 
Loading
Loading
@@ -5281,7 +5281,7 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;
[blue.layer addAnimation:animation forKey:@"opacity"];
[highlightingView.layer addAnimation:animation forKey:@"opacity"];
 
[CATransaction commit];
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment