1
0
Fork 0

the text case is again properly saved and restored on restart

This commit is contained in:
sspanak 2024-09-19 15:51:59 +03:00 committed by Dimo Karaivanov
parent 8b5d0f164a
commit c5f0e47eb5
2 changed files with 8 additions and 9 deletions

View file

@ -141,8 +141,7 @@ abstract public class CommandHandler extends TextEditingHandler {
int nextModeIndex = (allowedInputModes.indexOf(mInputMode.getId()) + 1) % allowedInputModes.size(); int nextModeIndex = (allowedInputModes.indexOf(mInputMode.getId()) + 1) % allowedInputModes.size();
mInputMode = InputMode.getInstance(settings, mLanguage, inputType, textField, allowedInputModes.get(nextModeIndex)); mInputMode = InputMode.getInstance(settings, mLanguage, inputType, textField, allowedInputModes.get(nextModeIndex));
mInputMode.setTextFieldCase(inputType.determineTextCase()); determineTextCase();
mInputMode.determineNextWordTextCase(textField.getStringBeforeCursor());
} }
// save the settings for the next time // save the settings for the next time
@ -167,7 +166,9 @@ abstract public class CommandHandler extends TextEditingHandler {
if (suggestionOps.isEmpty() || mInputMode.getSuggestions().isEmpty()) { if (suggestionOps.isEmpty() || mInputMode.getSuggestions().isEmpty()) {
// When there are no suggestions, there is no need to execute the code for // When there are no suggestions, there is no need to execute the code for
// adjusting them below. // adjusting them below.
mInputMode.nextTextCase(); if (mInputMode.nextTextCase()) {
settings.saveTextCase(mInputMode.getTextCase());
}
return; return;
} }
@ -194,6 +195,8 @@ abstract public class CommandHandler extends TextEditingHandler {
suggestionOps.set(mInputMode.getSuggestions(), currentSuggestionIndex, mInputMode.containsGeneratedSuggestions()); suggestionOps.set(mInputMode.getSuggestions(), currentSuggestionIndex, mInputMode.containsGeneratedSuggestions());
textField.setComposingText(suggestionOps.getCurrent()); textField.setComposingText(suggestionOps.getCurrent());
settings.saveTextCase(mInputMode.getTextCase());
} }

View file

@ -258,14 +258,10 @@ public abstract class TypingHandler extends KeyPadHandler {
/** /**
* determineTextCase * determineTextCase
* Restore the last text case or auto-select a new one. If the InputMode supports it, it can change * Restore the last used text case or auto-select a new one based on the input field properties.
* the text case based on grammar rules, otherwise we fallback to the input field properties or the
* last saved mode.
*/ */
private void determineTextCase() { protected void determineTextCase() {
mInputMode.defaultTextCase();
mInputMode.setTextFieldCase(inputType.determineTextCase()); mInputMode.setTextFieldCase(inputType.determineTextCase());
mInputMode.determineNextWordTextCase(textField.getStringBeforeCursor());
InputModeValidator.validateTextCase(mInputMode, settings.getTextCase()); InputModeValidator.validateTextCase(mInputMode, settings.getTextCase());
} }