From 7e3657185f55fe85c89509cc1ea57d305796bc6b Mon Sep 17 00:00:00 2001 From: Helium314 Date: Sun, 12 Jan 2025 21:02:29 +0100 Subject: [PATCH] prevent selected text being the first suggestion when overwriting with glide typing fixes #1284 --- .../java/helium314/keyboard/latin/inputlogic/InputLogic.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java b/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java index d2bfd242..d3239187 100644 --- a/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java +++ b/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java @@ -535,6 +535,11 @@ public final class InputLogic { } else { 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(); if (Character.isLetterOrDigit(codePointBeforeCursor)