diff options
author | 2013-12-16 21:32:13 +0900 | |
---|---|---|
committer | 2013-12-16 21:38:31 +0900 | |
commit | dc06ee85ef988aa073b2e9396546ad777c3c2784 (patch) | |
tree | f6fd7c06030922dfacc2deb4ddbac7ff7570f995 /java/src | |
parent | 769eb083efd39f43d1669ab5b6285461a17b3e22 (diff) | |
download | latinime-dc06ee85ef988aa073b2e9396546ad777c3c2784.tar.gz latinime-dc06ee85ef988aa073b2e9396546ad777c3c2784.tar.xz latinime-dc06ee85ef988aa073b2e9396546ad777c3c2784.zip |
A simplification.
This does the same thing, but simpler and faster.
Was noticed while investigating bug#12164555
Change-Id: If9926e4da8a53a65489da55197ac87122c44fe7c
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 8b466559c..1f6091e90 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -2565,26 +2565,20 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen final SettingsValues currentSettings = mSettings.getCurrent(); final int[] additionalFeaturesOptions = currentSettings.mAdditionalFeaturesSettingValues; - final String previousWord; - if (mWordComposer.isComposingWord() || mWordComposer.isBatchMode()) { - previousWord = mWordComposer.getPreviousWord(); - } else { - // Not composing: this is for prediction. - // TODO: read the previous word earlier for prediction, like we are doing for - // normal suggestions. - previousWord = getNthPreviousWordForSuggestion(currentSettings, 1 /* nthPreviousWord*/); - } if (DEBUG) { - // TODO: this is for checking consistency with older versions. Remove this when - // we are confident this is stable. - // We're checking the previous word in the text field against the memorized previous - // word. If we are composing a word we should have the second word before the cursor - // memorized, otherwise we should have the first. - final String rereadPrevWord = getNthPreviousWordForSuggestion(currentSettings, - mWordComposer.isComposingWord() ? 2 : 1); - if (!TextUtils.equals(previousWord, rereadPrevWord)) { - throw new RuntimeException("Unexpected previous word: " - + previousWord + " <> " + rereadPrevWord); + if (mWordComposer.isComposingWord() || mWordComposer.isBatchMode()) { + final String previousWord = mWordComposer.getPreviousWord(); + // TODO: this is for checking consistency with older versions. Remove this when + // we are confident this is stable. + // We're checking the previous word in the text field against the memorized previous + // word. If we are composing a word we should have the second word before the cursor + // memorized, otherwise we should have the first. + final String rereadPrevWord = getNthPreviousWordForSuggestion(currentSettings, + mWordComposer.isComposingWord() ? 2 : 1); + if (!TextUtils.equals(previousWord, rereadPrevWord)) { + throw new RuntimeException("Unexpected previous word: " + + previousWord + " <> " + rereadPrevWord); + } } } suggest.getSuggestedWords(mWordComposer, mWordComposer.getPreviousWord(), |