1
0
Fork 0

disabled word filtering when recomposing for more useful suggestions

This commit is contained in:
sspanak 2024-11-26 16:59:46 +02:00 committed by Dimo Karaivanov
parent 8070abd8f6
commit 399f7a414c
4 changed files with 11 additions and 9 deletions

View file

@ -279,7 +279,7 @@ public abstract class HotkeyHandler extends CommandHandler {
}
mInputMode.clearWordStem();
getSuggestions();
getSuggestions(null);
statusBar.setText(mInputMode);
mainView.render();
if (!suggestionOps.isEmpty() || settings.isMainLayoutStealth()) {

View file

@ -4,6 +4,7 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.ArrayList;
@ -129,7 +130,7 @@ public abstract class TypingHandler extends KeyPadHandler {
}
if (repeat == 0 && mInputMode.onBackspace()) {
getSuggestions();
getSuggestions(null);
} else {
suggestionOps.commitCurrent(false);
mInputMode.reset();
@ -150,7 +151,7 @@ public abstract class TypingHandler extends KeyPadHandler {
if (settings.getBackspaceRecomposing() && repeat == 0 && suggestionOps.isEmpty() && !DictionaryLoader.getInstance(this).isRunning()) {
final String previousWord = textField.getWordBeforeCursor(mLanguage, 0, false);
if (mInputMode.recompose(previousWord) && textField.recompose(previousWord)) {
getSuggestions();
getSuggestions(previousWord);
} else {
mInputMode.reset();
}
@ -203,7 +204,7 @@ public abstract class TypingHandler extends KeyPadHandler {
scrollSuggestions(false);
suggestionOps.scheduleDelayedAccept(mInputMode.getAutoAcceptTimeout());
} else {
getSuggestions();
getSuggestions(null);
}
return true;
@ -360,14 +361,15 @@ public abstract class TypingHandler extends KeyPadHandler {
return suggestionOps;
}
protected void getSuggestions() {
protected void getSuggestions(@Nullable String currentWord) {
if (InputModeKind.isPredictive(mInputMode) && DictionaryLoader.getInstance(this).isRunning()) {
mInputMode.reset();
UI.toastShortSingle(this, R.string.dictionary_loading_please_wait);
} else {
mInputMode
.setOnSuggestionsUpdated(this::handleSuggestions)
.loadSuggestions(suggestionOps.getCurrent());
.loadSuggestions(currentWord == null ? suggestionOps.getCurrent() : currentWord);
}
}

View file

@ -143,7 +143,6 @@ class ModeWords extends ModeCheonjiin {
reset();
digitSequence = language.getDigitSequenceForWord(word);
textCase = new Text(language, word).getTextCase();
setWordStem(word, true);
} catch (InvalidLanguageCharactersException e) {
Logger.d(LOG_TAG, "Not recomposing word: '" + word + "'. " + e.getMessage());
return false;

View file

@ -14,11 +14,12 @@ public class WordPredictions extends Predictions {
private String inputWord;
private boolean isStemFuzzy;
private String lastEnforcedTopWord = "";
private String lastEnforcedTopWord;
public WordPredictions(SettingsStore settings, TextField textField) {
super(settings);
lastEnforcedTopWord = "";
stem = "";
this.textField = textField;
}
@ -77,7 +78,7 @@ public class WordPredictions extends Predictions {
// If there were no database words for ",a", try getting the letters only (e.g. "a", "b", "c").
// We do this to display them in the correct order.
if (dbWords.isEmpty() && isRetryAllowed && digitSequence.length() == 2 && digitSequence.charAt(0) == '1') {
if (isRetryAllowed && dbWords.isEmpty() && digitSequence.length() == 2 && digitSequence.charAt(0) == '1') {
loadWithoutLeadingPunctuation();
return;
}