Merge "Restart suggestions when backspacing into a reverted word."

main
Tom Ouyang 2015-03-06 02:29:34 +00:00 committed by Android (Google) Code Review
commit 8eb2fad570
1 changed files with 14 additions and 0 deletions

View File

@ -1027,6 +1027,20 @@ public final class InputLogic {
revertCommit(inputTransaction, inputTransaction.mSettingsValues); revertCommit(inputTransaction, inputTransaction.mSettingsValues);
StatsUtils.onRevertAutoCorrect(); StatsUtils.onRevertAutoCorrect();
StatsUtils.onWordCommitUserTyped(lastComposedWord, mWordComposer.isBatchMode()); StatsUtils.onWordCommitUserTyped(lastComposedWord, mWordComposer.isBatchMode());
// Restart suggestions when backspacing into a reverted word. This is required for
// the final corrected word to be learned, as learning only occurs when suggestions
// are active.
//
// Note: restartSuggestionsOnWordTouchedByCursor is already called for normal
// (non-revert) backspace handling.
if (inputTransaction.mSettingsValues.isSuggestionsEnabledPerUserSettings()
&& inputTransaction.mSettingsValues.mSpacingAndPunctuations
.mCurrentLanguageHasSpaces
&& !mConnection.isCursorFollowedByWordCharacter(
inputTransaction.mSettingsValues.mSpacingAndPunctuations)) {
restartSuggestionsOnWordTouchedByCursor(inputTransaction.mSettingsValues,
false /* forStartInput */, currentKeyboardScriptId);
}
return; return;
} }
if (mEnteredText != null && mConnection.sameAsTextBeforeCursor(mEnteredText)) { if (mEnteredText != null && mConnection.sameAsTextBeforeCursor(mEnteredText)) {