From fa3567cb9ff2ed246c3cacc1f24b1b09e76333d7 Mon Sep 17 00:00:00 2001 From: daboe01 Date: Thu, 25 Jun 2015 06:03:02 +0200 Subject: [PATCH] fix arrow down last line --- AppKit/CPTextView/CPTextView.j | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index 57529d1ce..4015c7d23 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -893,17 +893,14 @@ var kDelegateRespondsTo_textShouldBeginEditing rectEnd = nglyphs ? [_layoutManager boundingRectForGlyphRange:CPMakeRange(nglyphs - 1, 1) inTextContainer:_textContainer] : rectSource, point = rectSource.origin; - if (point.y >= rectEnd.origin.y) - return; - if (_stickyXLocation) point.x = _stickyXLocation; - // FIXME: Define constants for this magic number + // FIXME: find a better way for getting the coordinates of the next line point.y += 2 + rectSource.size.height; point.x += 2; - var dindex= [_layoutManager glyphIndexForPoint:point inTextContainer:_textContainer fractionOfDistanceThroughGlyph:fraction], + var dindex= point.y >= CPRectGetMaxY(rectEnd) ? nglyphs : [_layoutManager glyphIndexForPoint:point inTextContainer:_textContainer fractionOfDistanceThroughGlyph:fraction], oldStickyLoc = _stickyXLocation; if (fraction[0] > 0.5)