File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 29332933 for ( ; ; ) {
29342934 if ( bidi ? to == from || to == moveVisually ( lineObj , from , 1 ) : to - from <= 1 ) {
29352935 var ch = x < fromX || x - fromX <= toX - x ? from : to ;
2936+ var outside = ch == from ? fromOutside : toOutside
29362937 var xDiff = x - ( ch == from ? fromX : toX ) ;
2938+ // This is a kludge to handle the case where the coordinates
2939+ // are after a line-wrapped line. We should replace it with a
2940+ // more general handling of cursor positions around line
2941+ // breaks. (Issue #4078)
2942+ if ( toOutside && ! bidi && ! / \s / . test ( lineObj . text . charAt ( ch ) ) && xDiff > 0 &&
2943+ ch < lineObj . text . length && preparedMeasure . view . measure . heights . length > 1 ) {
2944+ var charSize = measureCharPrepared ( cm , preparedMeasure , ch , "right" ) ;
2945+ if ( innerOff <= charSize . bottom && innerOff >= charSize . top && Math . abs ( x - charSize . right ) < xDiff ) {
2946+ outside = false
2947+ ch ++
2948+ xDiff = x - charSize . right
2949+ }
2950+ }
29372951 while ( isExtendingChar ( lineObj . text . charAt ( ch ) ) ) ++ ch ;
2938- var pos = PosWithInfo ( lineNo , ch , ch == from ? fromOutside : toOutside ,
2939- xDiff < - 1 ? - 1 : xDiff > 1 ? 1 : 0 ) ;
2952+ var pos = PosWithInfo ( lineNo , ch , outside , xDiff < - 1 ? - 1 : xDiff > 1 ? 1 : 0 ) ;
29402953 return pos ;
29412954 }
29422955 var step = Math . ceil ( dist / 2 ) , middle = from + step ;
You can’t perform that action at this time.
0 commit comments