diff options
author | 2012-02-22 00:05:19 -0800 | |
---|---|---|
committer | 2012-02-22 00:05:19 -0800 | |
commit | 9271b770e81350e232c351f76f9f7a2ec23dff5f (patch) | |
tree | 725ddba04dd7f9938e85818fb023ad313c120c7d /java/src/com/android/inputmethod/latin/WordComposer.java | |
parent | 32f0af1fc48f67907f0e731e18359f29e2b1df14 (diff) | |
download | latinime-9271b770e81350e232c351f76f9f7a2ec23dff5f.tar.gz latinime-9271b770e81350e232c351f76f9f7a2ec23dff5f.tar.xz latinime-9271b770e81350e232c351f76f9f7a2ec23dff5f.zip |
Activate the code to cancel a manual pick (A5)
This finally makes active the behavior described in
Bug: 5968922
Change-Id: I363ed23270c3dea75411ea806011225097b5d07c
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/WordComposer.java | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index 0fa28e49e..8121ada7f 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -310,17 +310,9 @@ public class WordComposer { // `type' should be one of the LastComposedWord.COMMIT_TYPE_* constants above. public LastComposedWord commitWord(final int type, final String committedWord, final int separatorCode) { - // Note: currently, we come here whenever we commit a word. If it's any *other* kind than - // DECIDED_WORD, we should deactivate the last composed word so that we don't attempt to - // cancel later. - // If it's a DECIDED_WORD, it may be an actual auto-correction by the IME, or what the user - // typed because the IME decided *not* to auto-correct for whatever reason. - // Ideally we would also null it when it was a DECIDED_WORD that was not an auto-correct. - // As it happens these two cases should behave differently, because the former can be - // canceled while the latter can't. Currently, we figure this out in - // LastComposedWord#didAutoCorrectToAnotherWord with #equals(). It would be marginally - // cleaner to do it here, but it would be slower (since we would #equals() for each commit, - // instead of only on cancel), and ultimately we want to figure it out even earlier anyway. + // Note: currently, we come here whenever we commit a word. If it's a MANUAL_PICK + // or a DECIDED_WORD we may cancel the commit later; otherwise, we should deactivate + // the last composed word to ensure this does not happen. final ArrayList<int[]> codes = mCodes; final int[] xCoordinates = mXCoordinates; final int[] yCoordinates = mYCoordinates; @@ -329,7 +321,8 @@ public class WordComposer { mYCoordinates = new int[N]; final LastComposedWord lastComposedWord = new LastComposedWord(codes, xCoordinates, yCoordinates, mTypedWord.toString(), committedWord, separatorCode); - if (type != LastComposedWord.COMMIT_TYPE_DECIDED_WORD) { + if (type != LastComposedWord.COMMIT_TYPE_DECIDED_WORD + && type != LastComposedWord.COMMIT_TYPE_MANUAL_PICK) { lastComposedWord.deactivate(); } mTypedWord.setLength(0); |