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
This commit is contained in:
Jean Chalard 2012-01-17 15:17:17 +09:00
parent a8ba49c253
commit edc6395d9b

View file

@ -1410,7 +1410,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (mDeleteCount > DELETE_ACCELERATE_AT) {
ic.deleteSurroundingText(1, 0);
}
restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(ic);
if (isSuggestionsRequested()) {
restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(ic);
}
}
}
}
@ -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;
}