1
0
Fork 0

new dev bug: moving the cursor manually, while filtering Chinese words, produces unexpected characters

This commit is contained in:
sspanak 2025-03-29 10:58:04 +02:00 committed by Dimo Karaivanov
parent 5554110b7d
commit f8d7af669d
3 changed files with 9 additions and 5 deletions

View file

@ -327,11 +327,8 @@ public abstract class TypingHandler extends KeyPadHandler {
// If the cursor moves while composing a word (usually, because the user has touched the screen outside the word), we must
// end typing end accept the word. Otherwise, the cursor would jump back at the end of the word, after the next key press.
// This is confusing from user perspective, so we want to avoid it.
if (
CursorOps.isMovedManually(newSelStart, newSelEnd, candidatesStart, candidatesEnd)
&& !suggestionOps.isEmpty()
) {
mInputMode.onAcceptSuggestion(suggestionOps.acceptIncomplete());
if (CursorOps.isMovedManually(newSelStart, newSelEnd, candidatesStart, candidatesEnd)) {
mInputMode.onCursorMove(suggestionOps.acceptIncomplete());
}
}

View file

@ -72,6 +72,7 @@ abstract public class InputMode {
// Suggestions
public void onAcceptSuggestion(@NonNull String word) { onAcceptSuggestion(word, false); }
public void onAcceptSuggestion(@NonNull String word, boolean preserveWordList) {}
public void onCursorMove(@NonNull String word) { if (!digitSequence.isEmpty()) onAcceptSuggestion(word); }
public void onReplaceSuggestion(@NonNull String word) {}
/**

View file

@ -106,6 +106,12 @@ public class ModeIdeograms extends ModeWords {
}
@Override public void onCursorMove(@NonNull String word) {
isFiltering = false;
super.onCursorMove(word);
}
@Override
public boolean shouldAcceptPreviousSuggestion(String s) {
return