2 // PBCommitMessageView.m
5 // Created by Jeff Mesnil on 13/10/08.
6 // Copyright 2008 Jeff Mesnil (http://jmesnil.net/). All rights reserved.
9 #import "PBCommitMessageView.h"
10 #import "PBGitDefaults.h"
12 @implementation PBCommitMessageView
14 - (void)drawRect:(NSRect)aRect
16 NSColor *originalColor = [self backgroundColor];
20 // draw a vertical line after the given size (used as an indicator
21 // for the first line of the commit message)
22 float characterWidth = [@" " sizeWithAttributes:[self typingAttributes]].width;
23 float lineWidth = characterWidth * [PBGitDefaults commitMessageViewVerticalLineLength];
25 [[NSColor lightGrayColor] set];
26 // This depends upon the fact that NSTextView always redraws complete lines.
27 float padding = [[self textContainer] lineFragmentPadding];
29 line.origin.x = padding + aRect.origin.x + lineWidth;
30 line.origin.y = aRect.origin.y;
32 line.size.height = aRect.size.height;
35 [self setBackgroundColor:nil];
36 [super drawRect:aRect];
37 [self setBackgroundColor:originalColor];