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

Commit b0336855 authored by Richard Ledley's avatar Richard Ledley Committed by Android (Google) Code Review
Browse files

Merge "Set selection bounds when we try to copy, so it will work with nonselectable text."

parents a04c32b1 4b823b94
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -11011,6 +11011,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                return true;

            case ID_COPY:
                // For link action mode in a non-selectable/non-focusable TextView,
                // make sure that we set the appropriate min/max.
                final int selStart = getSelectionStart();
                final int selEnd = getSelectionEnd();
                min = Math.max(0, Math.min(selStart, selEnd));
                max = Math.max(0, Math.max(selStart, selEnd));
                final ClipData copyData = ClipData.newPlainText(null, getTransformedText(min, max));
                if (setPrimaryClip(copyData)) {
                    stopTextActionMode();