Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit edc6395d authored by Jean Chalard's avatar Jean Chalard
Browse files

Fix a bug where words disappear on inserting separators

The basic idea is that in some situations, we would restart
suggestions, but before evaluating them we would bail out
because suggestions were not requested. This would lead to
the "correction" set to null, so we would commit a null word.

This fix does two things:
- Do not restart suggestions when not requested.
- If we still end up with a composing word when suggestions
  are not requested, we select the typed word as the
  correct version.

Bug: 5846646
Change-Id: Ic35351841d0cb20afa99092ef681ecb7bd68bec6
parent a8ba49c2
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1410,10 +1410,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
                if (mDeleteCount > DELETE_ACCELERATE_AT) {
                    ic.deleteSurroundingText(1, 0);
                }
                if (isSuggestionsRequested()) {
                    restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(ic);
                }
            }
        }
    }

    private void handleTab() {
        final int imeOptions = getCurrentInputEditorInfo().imeOptions;
@@ -1702,6 +1704,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
        // Check if we have a suggestion engine attached.
        if ((mSuggest == null || !isSuggestionsRequested())
                && !mVoiceProxy.isVoiceInputHighlighted()) {
            if (mWordComposer.isComposingWord()) {
                Log.w(TAG, "Called updateSuggestions but suggestions were not requested!");
                mWordComposer.setAutoCorrection(mWordComposer.getTypedWord());
            }
            return;
        }