Skip to content

Commit e168123

Browse files
lilyballbrotherbard
authored andcommitted
Draw commit message line more accurately
When drawing the commit message line, the given rect should not be used for anything other than clipping. According to the comment, the code that draws the line relies on the text view always drawing complete lines. However, it also draws fragments, specifically when the insertion point is flashing. By ignoring the given rect, not only is our line more accurate in its positioning, but we also handle the case where the insertion point is sitting on top of the line.
1 parent 7123fd6 commit e168123

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

PBCommitMessageView.m

+3-4
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ - (void)drawRect:(NSRect)aRect
2222
float lineWidth = characterWidth * [PBGitDefaults commitMessageViewVerticalLineLength];
2323

2424
[[NSColor lightGrayColor] set];
25-
// This depends upon the fact that NSTextView always redraws complete lines.
2625
float padding = [[self textContainer] lineFragmentPadding];
2726
NSRect line;
28-
line.origin.x = padding + aRect.origin.x + lineWidth;
29-
line.origin.y = aRect.origin.y;
27+
line.origin.x = padding + lineWidth;
28+
line.origin.y = 0;
3029
line.size.width = 1;
31-
line.size.height = aRect.size.height;
30+
line.size.height = [self bounds].size.height;
3231
NSRectFill(line);
3332
}
3433
}

0 commit comments

Comments
 (0)