Merge "Fix crash during TextView.onCreateContextMenu" into oc-dev am: 58df6ab93f
am: 92d86d59c0
Change-Id: I690ebf4df8e22a57c5f7b2b5e0267a550db15945
This commit is contained in:
@@ -2584,14 +2584,18 @@ public class Editor {
|
||||
if (offset == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
stopTextActionModeWithPreservingSelection();
|
||||
final boolean isOnSelection = mTextView.hasSelection()
|
||||
&& offset >= mTextView.getSelectionStart() && offset <= mTextView.getSelectionEnd();
|
||||
if (!isOnSelection) {
|
||||
// Right clicked position is not on the selection. Remove the selection and move the
|
||||
// cursor to the right clicked position.
|
||||
Selection.setSelection((Spannable) mTextView.getText(), offset);
|
||||
stopTextActionMode();
|
||||
if (mTextView.canSelectText()) {
|
||||
final boolean isOnSelection = mTextView.hasSelection()
|
||||
&& offset >= mTextView.getSelectionStart()
|
||||
&& offset <= mTextView.getSelectionEnd();
|
||||
if (!isOnSelection) {
|
||||
// Right clicked position is not on the selection. Remove the selection and move the
|
||||
// cursor to the right clicked position.
|
||||
Selection.setSelection((Spannable) mTextView.getText(), offset);
|
||||
stopTextActionMode();
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldOfferToShowSuggestions()) {
|
||||
|
||||
Reference in New Issue
Block a user