more cursor up fixes

This commit is contained in:
daboe01 committed 2015-12-30 21:16:02 +01:00
1 parent ab8c3c2b75
commit 87edda5972
1 file changed
+10 -6
+10 -6
View File
@@ -1011,16 +1011,20 @@ var kDelegateRespondsTo_textShouldBeginEditing
if (![self isSelectable])
return;
var dindex = [self selectedRange].location,
rectSource = [_layoutManager boundingRectForGlyphRange:CPMakeRange(dindex, 1) inTextContainer:_textContainer];
if (rectSource.origin.x > 0)
dindex = [_layoutManager glyphIndexForPoint:CGPointMake(0, rectSource.origin.y + 1) inTextContainer:_textContainer fractionOfDistanceThroughGlyph:nil];
var dindex = [self selectedRange].location;
if (dindex < 1)
return;
rectSource = [_layoutManager boundingRectForGlyphRange:CPMakeRange(dindex - 1, 1) inTextContainer:_textContainer]; // the line above
var rectSource = [_layoutManager boundingRectForGlyphRange:CPMakeRange(dindex, 1) inTextContainer:_textContainer];
if (!(dindex === [_layoutManager numberOfCharacters] && _isNewlineCharacter([[_textStorage string] characterAtIndex:dindex - 1])))
dindex = [_layoutManager glyphIndexForPoint:CGPointMake(0, rectSource.origin.y + 1) inTextContainer:_textContainer fractionOfDistanceThroughGlyph:nil];
if (dindex < 1)
return;
rectSource = [_layoutManager boundingRectForGlyphRange:CPMakeRange(dindex - 1, 1) inTextContainer:_textContainer];
dindex = [_layoutManager glyphIndexForPoint:CGPointMake(_stickyXLocation, rectSource.origin.y + 1) inTextContainer:_textContainer fractionOfDistanceThroughGlyph:nil];
var oldStickyLoc = _stickyXLocation;