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

Commit cae2c63f authored by Seigo Nonaka's avatar Seigo Nonaka Committed by Android Git Automerger
Browse files

am e96b1c6f: Merge "Fix crash due to reverse selection." into mnc-dev

* commit 'e96b1c6f':
  Fix crash due to reverse selection.
parents 25a96854 e96b1c6f
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -7577,12 +7577,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    }

    String getSelectedText() {
        if (hasSelection()) {
            return String.valueOf(mText.subSequence(getSelectionStart(), getSelectionEnd()));
        }
        if (!hasSelection()) {
            return null;
        }

        final int start = getSelectionStart();
        final int end = getSelectionEnd();
        return String.valueOf(
                start > end ? mText.subSequence(end, start) : mText.subSequence(start, end));
    }

    /**
     * Sets the properties of this field (lines, horizontally scrolling,
     * transformation method) to be for a single-line input.