diff options
author | 2012-02-21 23:41:42 -0800 | |
---|---|---|
committer | 2012-02-21 23:41:42 -0800 | |
commit | 1dfdc8056c93a2ea3e26f821af738ce1504af714 (patch) | |
tree | 352c464d1b0b1478c74d19e9c04fd72fc669d681 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | 8fe892945a898ee2235b8c4367eb42730db4c8d9 (diff) | |
parent | cf9d92629cae88273805eaf7984fcfdd8afd11f5 (diff) | |
download | latinime-1dfdc8056c93a2ea3e26f821af738ce1504af714.tar.gz latinime-1dfdc8056c93a2ea3e26f821af738ce1504af714.tar.xz latinime-1dfdc8056c93a2ea3e26f821af738ce1504af714.zip |
Merge "Give LastComposedWord knowledge of the committed word (A1)"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index a208a8748..fca9f8270 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1129,8 +1129,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void commitTyped(final InputConnection ic) { if (!mWordComposer.isComposingWord()) return; final CharSequence typedWord = mWordComposer.getTypedWord(); - mLastComposedWord = mWordComposer.commitWord(LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD); if (typedWord.length() > 0) { + mLastComposedWord = mWordComposer.commitWord( + LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD, typedWord.toString()); if (ic != null) { ic.commitText(typedWord, 1); } @@ -2002,7 +2003,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // what user typed. Note: currently this is done much later in // LastComposedWord#canCancelAutoCorrect by string equality of the remembered // strings. - mLastComposedWord = mWordComposer.commitWord(commitType); + mLastComposedWord = mWordComposer.commitWord(commitType, bestWord.toString()); } private static final WordComposer sEmptyWordComposer = new WordComposer(); @@ -2166,8 +2167,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // "ic" must not be null private void cancelAutoCorrect(final InputConnection ic) { final String originallyTypedWord = mLastComposedWord.mTypedWord; - final CharSequence autoCorrectedTo = mLastComposedWord.mAutoCorrection; - final int cancelLength = autoCorrectedTo.length(); + final CharSequence committedWord = mLastComposedWord.mCommittedWord; + final int cancelLength = committedWord.length(); final CharSequence separator = ic.getTextBeforeCursor(1, 0); if (DEBUG) { if (mWordComposer.isComposingWord()) { @@ -2176,9 +2177,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final String wordBeforeCursor = ic.getTextBeforeCursor(cancelLength + 1, 0).subSequence(0, cancelLength) .toString(); - if (!TextUtils.equals(autoCorrectedTo, wordBeforeCursor)) { + if (!TextUtils.equals(committedWord, wordBeforeCursor)) { throw new RuntimeException("cancelAutoCorrect check failed: we thought we were " - + "reverting \"" + autoCorrectedTo + + "reverting \"" + committedWord + "\", but before the cursor we found \"" + wordBeforeCursor + "\""); } if (TextUtils.equals(originallyTypedWord, wordBeforeCursor)) { |