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

View file

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