Skip to content

Commit

Permalink
fix(android/engine): Ignore updating invalid selections
Browse files Browse the repository at this point in the history
  • Loading branch information
darcywong00 committed May 23, 2024
1 parent 53b583e commit 3231964
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,13 @@ protected boolean updateSelectionRange() {

int selMin = icText.selectionStart, selMax = icText.selectionEnd;

if (selMin < 0 || selMax < 0) {
if (selMin < 0 || selMax < 0 || rawText.length() == 0) {
// There is no selection or cursor
// Reference https://developer.android.com/reference/android/text/Selection#getSelectionEnd(java.lang.CharSequence)
return false;
} else if (selMin > rawText.length()-1 || selMax > rawText.length()-1) {
// Selection is past existing text
return false;
}

if (selMin > selMax) {
Expand Down

0 comments on commit 3231964

Please sign in to comment.