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

Commit cf68fee0 authored by Gilles Debunne's avatar Gilles Debunne
Browse files

Bug 5254884: suggestions are no logner copied in the clipboard

Change-Id: I621c5b4da4252876b0f424e895a4e19e2a4dda50
parent 1c6ac4eb
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -9188,19 +9188,23 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                return true;

            case ID_CUT:
                setPrimaryClip(ClipData.newPlainText(null, mTransformed.subSequence(min, max)));
                setPrimaryClip(ClipData.newPlainText(null, getTransformedText(min, max)));
                ((Editable) mText).delete(min, max);
                stopSelectionActionMode();
                return true;

            case ID_COPY:
                setPrimaryClip(ClipData.newPlainText(null, mTransformed.subSequence(min, max)));
                setPrimaryClip(ClipData.newPlainText(null, getTransformedText(min, max)));
                stopSelectionActionMode();
                return true;
        }
        return false;
    }

    private CharSequence getTransformedText(int start, int end) {
        return removeSuggestionSpans(mTransformed.subSequence(start, end));
    }

    /**
     * Prepare text so that there are not zero or two spaces at beginning and end of region defined
     * by [min, max] when replacing this region by paste.
@@ -9317,7 +9321,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                // Start a drag
                final int start = getSelectionStart();
                final int end = getSelectionEnd();
                CharSequence selectedText = mTransformed.subSequence(start, end);
                CharSequence selectedText = getTransformedText(start, end);
                ClipData data = ClipData.newPlainText(null, selectedText);
                DragLocalState localState = new DragLocalState(this, start, end);
                startDrag(data, getTextThumbnailBuilder(selectedText), localState, 0);