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

Commit e96b1c6f authored by Seigo Nonaka's avatar Seigo Nonaka Committed by Android (Google) Code Review
Browse files

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

parents 253cea18 86d60cde
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.