mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-28 13:17:42 +00:00
fix for cursor up issue in multiple newlines
This commit is contained in:
@@ -1002,27 +1002,22 @@ var kDelegateRespondsTo_textShouldBeginEditing
|
||||
if (![self isSelectable])
|
||||
return;
|
||||
|
||||
var fraction = [],
|
||||
sindex = [self selectedRange].location,
|
||||
rectSource = [_layoutManager boundingRectForGlyphRange:CPMakeRange(sindex, 1) inTextContainer:_textContainer],
|
||||
point = rectSource.origin;
|
||||
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];
|
||||
|
||||
if (point.y <= 2)
|
||||
if (dindex < 1)
|
||||
return;
|
||||
|
||||
if (_stickyXLocation)
|
||||
point.x = _stickyXLocation;
|
||||
|
||||
point.y -= 2; // FIXME <!> these should not be constants
|
||||
|
||||
var dindex = [_layoutManager glyphIndexForPoint:point inTextContainer:_textContainer fractionOfDistanceThroughGlyph:fraction],
|
||||
oldStickyLoc = _stickyXLocation;
|
||||
|
||||
if (fraction[0] > 0.5)
|
||||
dindex++;
|
||||
rectSource = [_layoutManager boundingRectForGlyphRange:CPMakeRange(dindex - 1, 1) inTextContainer:_textContainer]; // the line above
|
||||
dindex = [_layoutManager glyphIndexForPoint:CGPointMake(_stickyXLocation, rectSource.origin.y + 1) inTextContainer:_textContainer fractionOfDistanceThroughGlyph:nil];
|
||||
|
||||
var oldStickyLoc = _stickyXLocation;
|
||||
[self _establishSelection:CPMakeRange(dindex,0) byExtending:NO];
|
||||
_stickyXLocation = oldStickyLoc;
|
||||
|
||||
[self scrollRangeToVisible:CPMakeRange(dindex, 0)];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user