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

Commit 89d77874 authored by Gilles Debunne's avatar Gilles Debunne Committed by Android (Google) Code Review
Browse files

Merge "Selecting text from a punctuation sign selects previous word."

parents 2008e06b 07a11f49
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -7598,6 +7598,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        int start = end;

        for (; start > 0; start--) {
            if (start == end) {
                // Cases where the text ends with a '.' and we select from the end of the line
                // (right after the dot), or when we select from the space character in "aaa, bbb".
                final char c = mTransformed.charAt(start);
                final int type = Character.getType(c);
                if (type == Character.OTHER_PUNCTUATION) continue;
            }
            if (!isWordCharacter(start - 1)) break;
            if ((end - start) > MAX_LENGTH) return -1;
        }