fix inconsistent behavior when switching text fields

actually the previous input attributes were used initially, which caused suggestions to show up or not depending on the previously selected field
moving the settings reload should be safe, at least i checked for potential issues
This commit is contained in:
Helium314 2024-05-26 19:34:55 +02:00
parent af3d0535b2
commit fb26eb8e7a

View file

@ -947,6 +947,13 @@ public class LatinIME extends InputMethodService implements
// Note: This call should be done by InputMethodService?
updateFullscreenMode();
// we need to reload the setting before using them, e.g. in startInput or in postResumeSuggestions
// not sure why it was further below, but this introduced inconsistent behavior where wrong input attributes were used
if (isDifferentTextField ||
!currentSettingsValues.hasSameOrientation(getResources().getConfiguration())) {
loadSettings();
currentSettingsValues = mSettings.getCurrent();
}
// ALERT: settings have not been reloaded and there is a chance they may be stale.
// In the practice, if it is, we should have gotten onConfigurationChanged so it should
// be fine, but this is horribly confusing and must be fixed AS SOON AS POSSIBLE.
@ -990,14 +997,8 @@ public class LatinIME extends InputMethodService implements
needToCallLoadKeyboardLater = false;
}
if (isDifferentTextField ||
!currentSettingsValues.hasSameOrientation(getResources().getConfiguration())) {
loadSettings();
}
if (isDifferentTextField) {
mainKeyboardView.closing();
currentSettingsValues = mSettings.getCurrent();
if (currentSettingsValues.mAutoCorrectEnabled) {
suggest.setAutoCorrectionThreshold(currentSettingsValues.mAutoCorrectionThreshold);
}