Skip to content

Commit

Permalink
Fix position of line highlight.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinh committed Jul 8, 2012
1 parent 9fcd087 commit 13224c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* Fixed a crash when using ctags over SFTP.
* Fixed a crash when creating new files over SFTP.
* Make line highlight centered vertically around the cursor.
* Fixed stability issue when closing windows.
* Require UUID in bundle items, allows loading incomplete bundles.


Expand Down
18 changes: 1 addition & 17 deletions app/ViTextView-cursor.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,7 @@ - (void)invalidateCaretRect
}

if (_highlightCursorLine && _lineHighlightColor && mode != ViVisualMode) {
NSRange lineRange;
if (length == 0) {
_lineHighlightRect = NSMakeRect(0, 0, 10000, _characterSize.height);
} else {
NSUInteger glyphIndex = [lm glyphIndexForCharacterAtIndex:IMIN(caret, length - 1)];
[lm lineFragmentRectForGlyphAtIndex:glyphIndex effectiveRange:&lineRange];
if (lineRange.length > 0) {
NSUInteger eol = [lm characterIndexForGlyphAtIndex:NSMaxRange(lineRange) - 1];
if ([[ts string] characterAtIndex:eol] == '\n') // XXX: what about other line endings?
lineRange.length -= 1;
}

_lineHighlightRect = [lm boundingRectForGlyphRange:lineRange
inTextContainer:[self textContainer]];
_lineHighlightRect.size.width = 10000;
_lineHighlightRect.origin.x = 0;
}
_lineHighlightRect = NSMakeRect(0, _caretRect.origin.y, 10000, _caretRect.size.height);
}

[self setNeedsDisplayInRect:_oldCaretRect];
Expand Down

0 comments on commit 13224c5

Please sign in to comment.