From 0e176582697bc63ef30a6a95ea43dc6364af984c Mon Sep 17 00:00:00 2001 From: daboe01 Date: Thu, 31 Dec 2015 10:42:33 +0100 Subject: [PATCH] use fraction again in cursorUp --- AppKit/CPTextView/CPTextView.j | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index fa69da99b..d86a647c6 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -1024,8 +1024,12 @@ var kDelegateRespondsTo_textShouldBeginEditing if (dindex < 1) return; + var fraction = []; rectSource = [_layoutManager boundingRectForGlyphRange:CPMakeRange(dindex - 1, 1) inTextContainer:_textContainer]; - dindex = [_layoutManager glyphIndexForPoint:CGPointMake(_stickyXLocation, rectSource.origin.y + 1) inTextContainer:_textContainer fractionOfDistanceThroughGlyph:nil]; + dindex = [_layoutManager glyphIndexForPoint:CGPointMake(_stickyXLocation, rectSource.origin.y + 1) inTextContainer:_textContainer fractionOfDistanceThroughGlyph:fraction]; + + if (fraction[0] > 0.5) + dindex++; var oldStickyLoc = _stickyXLocation; [self _establishSelection:CPMakeRange(dindex,0) byExtending:NO];