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

Commit 36d5a7b2 authored by Mady Mellor's avatar Mady Mellor Committed by Roozbeh Pournader
Browse files

Ensure to reset state of selecting by word/char for new selections

Previously this value was only updated when interacting with the
selection handles, so if you started a selection, entered by-char mode,
and then started another selection you would still be in by-char mode.
This resulted in incorrect behavior.

This CL alters the logic to update the handle state whenever the cursor
is placed which will included the initial long press to select a word.

Bug: 21301589
Change-Id: I15dbe6f2b76c7edd8ea4b3ba53e7107c47bc48fa
parent 59845bef
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -4065,11 +4065,16 @@ public class Editor {
                    offset = getNextCursorOffset(selectionEnd, false);
                    offset = getNextCursorOffset(selectionEnd, false);
                    mTouchWordDelta = 0.0f;
                    mTouchWordDelta = 0.0f;
                }
                }
                mInWord = !getWordIteratorWithText().isBoundary(offset);
                positionAtCursorOffset(offset, false);
                positionAtCursorOffset(offset, false);
            }
            }
        }
        }


        @Override
        protected void positionAtCursorOffset(int offset, boolean parentScrolled) {
            super.positionAtCursorOffset(offset, parentScrolled);
            mInWord = !getWordIteratorWithText().isBoundary(offset);
        }

        @Override
        @Override
        public boolean onTouchEvent(MotionEvent event) {
        public boolean onTouchEvent(MotionEvent event) {
            boolean superResult = super.onTouchEvent(event);
            boolean superResult = super.onTouchEvent(event);
@@ -4187,11 +4192,16 @@ public class Editor {
                    offset = getNextCursorOffset(selectionStart, true);
                    offset = getNextCursorOffset(selectionStart, true);
                    mTouchWordDelta = 0.0f;
                    mTouchWordDelta = 0.0f;
                }
                }
                mInWord = !getWordIteratorWithText().isBoundary(offset);
                positionAtCursorOffset(offset, false);
                positionAtCursorOffset(offset, false);
            }
            }
        }
        }


        @Override
        protected void positionAtCursorOffset(int offset, boolean parentScrolled) {
            super.positionAtCursorOffset(offset, parentScrolled);
            mInWord = !getWordIteratorWithText().isBoundary(offset);
        }

        @Override
        @Override
        public boolean onTouchEvent(MotionEvent event) {
        public boolean onTouchEvent(MotionEvent event) {
            boolean superResult = super.onTouchEvent(event);
            boolean superResult = super.onTouchEvent(event);