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

Commit 8cdb6841 authored by Kenny Root's avatar Kenny Root
Browse files

Revert to previous text selection behavior

There was a new behavior that starting "Select text" would allow you to
swipe from beginning to end and immediately copy that. This change
reverts to the previous behavior that "Select text" will start where
your cursor is currently and any tap will extend the selection from that
origin to the point of the tap.

Change-Id: Ib955cc8d62a652f518435953da2f54e810d9dfb0
parent 5923c971
Loading
Loading
Loading
Loading
+31 −23
Original line number Diff line number Diff line
@@ -252,7 +252,6 @@ implements MovementMethod
              int offset = getOffset(x, y, widget);

              if (cap) {

                  buffer.setSpan(LAST_TAP_DOWN, offset, offset,
                                 Spannable.SPAN_POINT_POINT);

@@ -292,7 +291,7 @@ implements MovementMethod
                              (MetaKeyKeyListener.getMetaState(buffer,
                                MetaKeyKeyListener.META_SELECTING) != 0);

                if (cap & handled) {
                if (cap && handled) {
                    // Before selecting, make sure we've moved out of the "slop".
                    // handled will be true, if we're in select mode AND we're
                    // OUT of the slop
@@ -308,6 +307,10 @@ implements MovementMethod
                    int y = (int) event.getY();
                    int offset = getOffset(x, y, widget);

                    final OnePointFiveTapState[] tap = buffer.getSpans(0, buffer.length(),
                            OnePointFiveTapState.class);

                    if (tap.length > 0 && tap[0].active) {
                        // Get the last down touch position (the position at which the
                        // user started the selection)
                        int lastDownOffset = buffer.getSpanStart(LAST_TAP_DOWN);
@@ -330,6 +333,9 @@ implements MovementMethod
                            spanend = findWordStart(buffer, offset);
                        }
                        Selection.setSelection(buffer, spanstart, spanend);
                    } else {
                        Selection.extendSelection(buffer, offset);
                    }
                    return true;
                }
            } else if (event.getAction() == MotionEvent.ACTION_UP) {
@@ -393,6 +399,8 @@ implements MovementMethod
                        // If we selecting something with the onepointfivetap-and
                        // swipe gesture, stop it on finger up.
                        MetaKeyKeyListener.stopSelecting(widget, buffer);
                    } else {
                        Selection.extendSelection(buffer, off);
                    }
                } else if (doubletap) {
                    Selection.setSelection(buffer,