Skip to content

Commit

Permalink
Fix issue #48
Browse files Browse the repository at this point in the history
  • Loading branch information
percontation committed Nov 26, 2014
1 parent 6f99390 commit 3b153ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/sources/HFRepresenterTextView.m
Expand Up @@ -455,8 +455,8 @@ - (void)updateSelectionPulse {
NSRange lastRange = [[ranges lastObject] rangeValue];
BOOL emptySelection = [ranges count] == 1 && firstRange.length == 0;
NSPoint startPoint = [self originForCharacterAtByteIndex:firstRange.location];
// don't just use originForCharacterAtByteIndex:NSMaxRange(lastRange), because if the last selected character is at the end of the line, this will cause us to highlight the next line. Instead, get the last selected character, and add an advance to it.
NSPoint endPoint = [self originForCharacterAtByteIndex:NSMaxRange(lastRange) - 1];
// don't just use originForCharacterAtByteIndex:NSMaxRange(lastRange), because if the last selected character is at the end of the line, this will cause us to highlight the next line. Special case empty selections, where this would wrap to the previous line.
NSPoint endPoint = emptySelection ? startPoint : [self originForCharacterAtByteIndex:NSMaxRange(lastRange) - 1];
endPoint.x += [self advancePerCharacter];
HFASSERT(endPoint.y >= startPoint.y);
NSRect bounds = [self bounds];
Expand Down

0 comments on commit 3b153ef

Please sign in to comment.