I don't personally understand the reason for the feature, but the
vertical line indicating a 50 column width in the PBCommitMessageView
was causing the entire text view to be redrawn with each cursor blink
(in and out) for the key window. Instead of keeping the subclassed
NSTextView, I placed a subclassed NSView behind the NSTextView, and
then I set the (commit) NSScrollView and NSTextView to not draw their
background. Now when the cursor blinks, only the single line of the
NSTextView is redrawn, and the dirty portion of the subclassed NSView
(PBCommitMessageBackgroundView) is redrawn. The
PBCommitMessageBackgroundView references the commit NSTextView for the
typing attributes, background color, etc.
The other significant contributor to CPU usage was the Commit button
fading in and out continuously. While it looks nice for panels and
alerts, the NSButton with the Return key equivalent is not appropriate
for the Commit window. The NSTextView (formerly PBCommitMessageView)
is first responder and accepts the Return character, thereby masking
the Commit button from receiving the key equivalent. Removing the key
equivalent binding for the Commit button eliminated the remaining CPU
usage.
With these two changes, and three projects open in GitX on the Commit
view, the CPU usage for the active application has gone from ~33% to
~0.3%. When GitX is not the active application, CPU usage drops to
0.0%.
I'm not sure if/how you want to incorporate the .xib changes (as we
appear to be using different versions of the dev tools), but please
find the attached patches for my changes.
remember the 50 character mark. Could we also add something similar
for the 72 character mark?
It might be worth considering using the approach using with VIM
integration:
http://vim.runpaint.org/extending/integrating-vim-with-git/
Dave