diff options
author | 2011-02-25 18:11:18 +0900 | |
---|---|---|
committer | 2011-03-02 04:30:03 +0900 | |
commit | 025a5e356ec74dbed7f805a2e43adbb2a35320f8 (patch) | |
tree | 3a91d7b080ef3548d3bf01981b8753c53a089239 /java/src | |
parent | 952cb7e973bbc4c09728cb5967505f84c80c8bd6 (diff) | |
download | latinime-025a5e356ec74dbed7f805a2e43adbb2a35320f8.tar.gz latinime-025a5e356ec74dbed7f805a2e43adbb2a35320f8.tar.xz latinime-025a5e356ec74dbed7f805a2e43adbb2a35320f8.zip |
Reset the suggestion status when composing span gets cleared
bug: 3353818
Change-Id: I87b80470015dbeb2eaaec9aa4d9d802597c18e19
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 3ff072ef2..3a97846fa 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -694,6 +694,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (DEBUG) { Log.i(TAG, "onUpdateSelection: oss=" + oldSelStart + ", ose=" + oldSelEnd + + ", lss=" + mLastSelectionStart + + ", lse=" + mLastSelectionEnd + ", nss=" + newSelStart + ", nse=" + newSelEnd + ", cs=" + candidatesStart @@ -704,9 +706,18 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // If the current selection in the text view changes, we should // clear whatever candidate text we have. - if ((((mComposing.length() > 0 && mHasValidSuggestions) - || mVoiceConnector.isVoiceInputHighlighted()) && (newSelStart != candidatesEnd - || newSelEnd != candidatesEnd) && mLastSelectionStart != newSelStart)) { + final boolean selectionChanged = (newSelStart != candidatesEnd + || newSelEnd != candidatesEnd) && mLastSelectionStart != newSelStart; + final boolean candidatesCleared = candidatesStart == -1 && candidatesEnd == -1; + if (((mComposing.length() > 0 && mHasValidSuggestions) + || mVoiceConnector.isVoiceInputHighlighted()) + && (selectionChanged || candidatesCleared)) { + if (candidatesCleared) { + // If the composing span has been cleared, save the typed word in the history for + // recorrection before we reset the candidate strip. Then, we'll be able to show + // suggestions for recorrection right away. + saveWordInHistory(mComposing); + } mComposing.setLength(0); mHasValidSuggestions = false; mHandler.postUpdateSuggestions(); |