From e168123c0eb38d518d18e49d1ab80829decb6ba7 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Tue, 9 Nov 2010 15:54:11 -0800 Subject: [PATCH] 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. --- PBCommitMessageView.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/PBCommitMessageView.m b/PBCommitMessageView.m index c9c8c43..da24242 100644 --- a/PBCommitMessageView.m +++ b/PBCommitMessageView.m @@ -22,13 +22,12 @@ float lineWidth = characterWidth * [PBGitDefaults commitMessageViewVerticalLineLength]; [[NSColor lightGrayColor] set]; - // This depends upon the fact that NSTextView always redraws complete lines. float padding = [[self textContainer] lineFragmentPadding]; NSRect line; - line.origin.x = padding + aRect.origin.x + lineWidth; - line.origin.y = aRect.origin.y; + line.origin.x = padding + lineWidth; + line.origin.y = 0; line.size.width = 1; - line.size.height = aRect.size.height; + line.size.height = [self bounds].size.height; NSRectFill(line); } }