Skip to content

Commit cf68fee

Browse files
author
Gilles Debunne
committed
Bug 5254884: suggestions are no logner copied in the clipboard
Change-Id: I621c5b4da4252876b0f424e895a4e19e2a4dda50
1 parent 1c6ac4e commit cf68fee

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

core/java/android/widget/TextView.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9188,19 +9188,23 @@ public boolean onTextContextMenuItem(int id) {
91889188
return true;
91899189

91909190
case ID_CUT:
9191-
setPrimaryClip(ClipData.newPlainText(null, mTransformed.subSequence(min, max)));
9191+
setPrimaryClip(ClipData.newPlainText(null, getTransformedText(min, max)));
91929192
((Editable) mText).delete(min, max);
91939193
stopSelectionActionMode();
91949194
return true;
91959195

91969196
case ID_COPY:
9197-
setPrimaryClip(ClipData.newPlainText(null, mTransformed.subSequence(min, max)));
9197+
setPrimaryClip(ClipData.newPlainText(null, getTransformedText(min, max)));
91989198
stopSelectionActionMode();
91999199
return true;
92009200
}
92019201
return false;
92029202
}
92039203

9204+
private CharSequence getTransformedText(int start, int end) {
9205+
return removeSuggestionSpans(mTransformed.subSequence(start, end));
9206+
}
9207+
92049208
/**
92059209
* Prepare text so that there are not zero or two spaces at beginning and end of region defined
92069210
* by [min, max] when replacing this region by paste.
@@ -9317,7 +9321,7 @@ public boolean performLongClick() {
93179321
// Start a drag
93189322
final int start = getSelectionStart();
93199323
final int end = getSelectionEnd();
9320-
CharSequence selectedText = mTransformed.subSequence(start, end);
9324+
CharSequence selectedText = getTransformedText(start, end);
93219325
ClipData data = ClipData.newPlainText(null, selectedText);
93229326
DragLocalState localState = new DragLocalState(this, start, end);
93239327
startDrag(data, getTextThumbnailBuilder(selectedText), localState, 0);

0 commit comments

Comments
 (0)