prevent selected text being the first suggestion when overwriting with glide typing

fixes #1284
This commit is contained in:
Helium314 2025-01-12 21:02:29 +01:00
parent de5968d04a
commit 7e3657185f

View file

@ -535,6 +535,11 @@ public final class InputLogic {
} else { } else {
commitTyped(settingsValues, LastComposedWord.NOT_A_SEPARATOR); commitTyped(settingsValues, LastComposedWord.NOT_A_SEPARATOR);
} }
} else if (mConnection.hasSelection()) {
final CharSequence selectedText = mConnection.getSelectedText(0);
if (selectedText != null)
// set selected text as rejected to avoid glide typing resulting in exactly the selected word again
mWordComposer.setRejectedBatchModeSuggestion(selectedText.toString());
} }
final int codePointBeforeCursor = mConnection.getCodePointBeforeCursor(); final int codePointBeforeCursor = mConnection.getCodePointBeforeCursor();
if (Character.isLetterOrDigit(codePointBeforeCursor) if (Character.isLetterOrDigit(codePointBeforeCursor)