replace old fix from 9713c4a25a with improved consistency check

and avoid somewhat unexpected crash
This commit is contained in:
Helium314 2024-06-11 22:02:32 +02:00
parent ce30c3b294
commit 843b8c44f7
2 changed files with 48 additions and 66 deletions

View file

@ -1353,9 +1353,7 @@ public final class InputLogic {
if (!mConnection.hasSelection()
&& settingsValues.isSuggestionsEnabledPerUserSettings()
&& settingsValues.mSpacingAndPunctuations.mCurrentLanguageHasSpaces) {
final TextRange range = mConnection.getWordRangeAtCursor(
settingsValues.mSpacingAndPunctuations,
currentKeyboardScript, false);
final TextRange range = mConnection.getWordRangeAtCursor(settingsValues.mSpacingAndPunctuations, currentKeyboardScript);
if (range != null) {
return range.mWord.toString();
}
@ -1709,8 +1707,7 @@ public final class InputLogic {
mConnection.finishComposingText();
return;
}
final TextRange range =
mConnection.getWordRangeAtCursor(settingsValues.mSpacingAndPunctuations, currentKeyboardScript, true);
final TextRange range = mConnection.getWordRangeAtCursor(settingsValues.mSpacingAndPunctuations, currentKeyboardScript);
if (null == range) return; // Happens if we don't have an input connection at all
if (range.length() <= 0) {
// Race condition, or touching a word in a non-supported script.