move to end of line fix

This commit is contained in:
daboe01 committed 2015-07-02 06:03:05 +02:00
1 parent d22a7c0a63
commit ce45f2e114
1 file changed
+5 -2
+5 -2
View File
@@ -1206,7 +1206,9 @@ var kDelegateRespondsTo_textShouldBeginEditing
if (![self isSelectable])
return;
var fragment = [_layoutManager _firstLineFragmentForLineFromLocation:_selectionRange.location];
var nglyphs = [_layoutManager numberOfCharacters],
loc = nglyphs == _selectionRange.location ? MAX(0, _selectionRange.location - 1) : _selectionRange.location;
fragment = [_layoutManager _firstLineFragmentForLineFromLocation:loc];
if (fragment)
[self _establishSelection:CPMakeRange(fragment._range.location, 0) byExtending:flag];
@@ -1232,7 +1234,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
if (!fragment)
return;
var loc = MAX(0, CPMaxRange(fragment._range) - 1);
var nglyphs = [_layoutManager numberOfCharacters],
loc = nglyphs == CPMaxRange(fragment._range) ? nglyphs : MAX(0, CPMaxRange(fragment._range) - 1);
[self _establishSelection:CPMakeRange(loc, 0) byExtending:flag];
}