aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index d36140de6..94c47bdc9 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1881,6 +1881,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
return;
}
+ // We need to log before we commit, because the word composer will store away the user
+ // typed word.
+ LatinImeLogger.logOnManualSuggestion(mWordComposer.getTypedWord().toString(),
+ suggestion.toString(), index, suggestions.mWords);
mExpectingUpdateSelection = true;
commitChosenWord(suggestion, WordComposer.COMMIT_TYPE_MANUAL_PICK);
// Add the word to the auto dictionary if it's not a known word
@@ -1890,10 +1894,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
} else {
addToOnlyBigramDictionary(suggestion, 1);
}
- // TODO: the following is fishy, because it seems there may be cases where we are not
- // composing a word at all. Maybe throw an exception if !mWordComposer.isComposingWord() ?
- LatinImeLogger.logOnManualSuggestion(mWordComposer.getTypedWord().toString(),
- suggestion.toString(), index, suggestions.mWords);
// Follow it with a space
if (mInputAttributes.mInsertSpaceOnPickSuggestionManually) {
sendMagicSpace();
@@ -2129,12 +2129,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
final String wordBeforeCursor =
ic.getTextBeforeCursor(cancelLength + 1, 0).subSequence(0, cancelLength)
.toString();
- if (!autoCorrectedTo.equals(wordBeforeCursor)) {
+ if (!TextUtils.equals(autoCorrectedTo, wordBeforeCursor)) {
throw new RuntimeException("cancelAutoCorrect check failed: we thought we were "
+ "reverting \"" + autoCorrectedTo
+ "\", but before the cursor we found \"" + wordBeforeCursor + "\"");
}
- if (originallyTypedWord.equals(wordBeforeCursor)) {
+ if (TextUtils.equals(originallyTypedWord, wordBeforeCursor)) {
throw new RuntimeException("cancelAutoCorrect check failed: we wanted to cancel "
+ "auto correction and revert to \"" + originallyTypedWord
+ "\" but we found this very string before the cursor");
@@ -2169,7 +2169,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
final String wordBeforeCursor =
ic.getTextBeforeCursor(restartLength + 1, 0).subSequence(0, restartLength)
.toString();
- if (!mWordComposer.getTypedWord().equals(wordBeforeCursor)) {
+ if (!TextUtils.equals(mWordComposer.getTypedWord(), wordBeforeCursor)) {
throw new RuntimeException("restartSuggestionsOnManuallyPickedTypedWord "
+ "check failed: we thought we were reverting \""
+ mWordComposer.getTypedWord()