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

Commit bb6a62c2 authored by Seigo Nonaka's avatar Seigo Nonaka Committed by Raph Levien
Browse files

Fix unexpected selection cancellation

It turned out that text selection is unexpectedly cancelled by
InsertionPointController if it is visible. The InsertPointController
is not necessary if there is a selection, so just hiding before
performing set selection fixes this issue.

Bug: 19946192
Change-Id: I2afce1789d772a8d2ea368643cc7533561ee2bf0
parent f37c099c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -557,7 +557,7 @@ public class Editor {
        }
    }

    private void hideInsertionPointCursorController() {
    void hideInsertionPointCursorController() {
        if (mInsertionPointCursorController != null) {
            mInsertionPointCursorController.hide();
        }
+6 −0
Original line number Diff line number Diff line
@@ -9037,6 +9037,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    }

    boolean selectAllText() {
        // Need to hide insert point cursor controller before settings selection, otherwise insert
        // point cursor controller obtains cursor update event and update cursor with cancelling
        // selection.
        if (mEditor != null) {
            mEditor.hideInsertionPointCursorController();
        }
        final int length = mText.length();
        Selection.setSelection((Spannable) mText, 0, length);
        return length > 0;