Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee3821e5 authored by Mady Mellor's avatar Mady Mellor
Browse files

Insertion cursor: add some slop for moving between lines

Applying same method to insertion cursor as the text selection drag
handles to improve moving along lines.

Basically adds some slop above / below the current line and only
allows you to change lines if you move outside of that.

Bug: 21306433
Change-Id: I6c7f3a496fbd1ea66936832f96325736cea872aa
parent 13e54ff0
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -4013,7 +4013,15 @@ public class Editor {

        @Override
        public void updatePosition(float x, float y) {
            positionAtCursorOffset(mTextView.getOffsetForPosition(x, y), false);
            Layout layout = mTextView.getLayout();
            int offset;
            if (layout != null) {
                int currLine = getCurrentLineAdjustedForSlop(layout, mPrevLine, y);
                offset = mTextView.getOffsetAtCoordinate(currLine, x);
            } else {
                offset = mTextView.getOffsetForPosition(x, y);
            }
            positionAtCursorOffset(offset, false);
            if (mTextActionMode != null) {
                mTextActionMode.invalidate();
            }