diff options
author | 2012-01-26 17:20:51 +0900 | |
---|---|---|
committer | 2012-01-26 19:57:37 +0900 | |
commit | c7c152de4b42853086fc6fd918387ad0583d0e3e (patch) | |
tree | 80df8af09ed914b4602ba96b9d8ca485aefe8b42 /java/src | |
parent | b6b8729374dc68b153f00730c79828532acf1ee5 (diff) | |
download | latinime-c7c152de4b42853086fc6fd918387ad0583d0e3e.tar.gz latinime-c7c152de4b42853086fc6fd918387ad0583d0e3e.tar.xz latinime-c7c152de4b42853086fc6fd918387ad0583d0e3e.zip |
Guard against wrong auto-correction cancellation (A6)
This deactivates the cancellation at each separator pressed while
not composing a word. The net effect is to fix
Bug: 5875776
Change-Id: I67aa3f842ddff250828c60596ad5a7e466c1ddaa
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 94da0cfb2..2e7e82637 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1274,6 +1274,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mHandler.cancelDoubleSpacesTimer(); } + boolean didAutoCorrect = false; switch (primaryCode) { case Keyboard.CODE_DELETE: mSpaceState = SPACE_STATE_NONE; @@ -1310,7 +1311,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar default: mSpaceState = SPACE_STATE_NONE; if (mSettingsValues.isWordSeparator(primaryCode)) { - handleSeparator(primaryCode, x, y, spaceState); + didAutoCorrect = handleSeparator(primaryCode, x, y, spaceState); } else { handleCharacter(primaryCode, keyCodes, x, y, spaceState); } @@ -1319,6 +1320,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } switcher.onCodeInput(primaryCode); // Reset after any single keystroke + if (!didAutoCorrect) + mLastComposedWord.deactivate(); mEnteredText = null; } @@ -1562,7 +1565,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } - private void handleSeparator(final int primaryCode, final int x, final int y, + // Returns true if we did an autocorrection, false otherwise. + private boolean handleSeparator(final int primaryCode, final int x, final int y, final int spaceState) { mVoiceProxy.handleSeparator(); mComposingStateManager.onFinishComposingText(); @@ -1573,6 +1577,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mHandler.postUpdateSuggestions(); } + boolean didAutoCorrect = false; // Handle separator final InputConnection ic = getCurrentInputConnection(); if (ic != null) { @@ -1587,6 +1592,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar && !mInputAttributes.mInputTypeNoAutoCorrect; if (shouldAutoCorrect && primaryCode != Keyboard.CODE_SINGLE_QUOTE) { commitCurrentAutoCorrection(primaryCode, ic); + didAutoCorrect = true; } else { commitTyped(ic); } @@ -1642,6 +1648,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (ic != null) { ic.endBatchEdit(); } + return didAutoCorrect; } private CharSequence getTextWithUnderline(final CharSequence text) { |