From a05a0f20776b4c33f41f043f1bff245331937580 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Mon, 27 Aug 2012 20:09:46 +0900 Subject: Allow Latin IME to cancel smiley-auto-correct consistenly This change makes Latin IME behave consistently with regards to other auto-correction cancellations in cases of auto-correction cancellation after smiley-triggered auto-correction. That is, pressing the smiley key when the keyboard signals it's about to auto-correct will get the auto-correction there plus a smiley, and pressing backspace will cancel the auto-correction, and pressing backspace again will delete the smiley. Bug: 7067593 Change-Id: Ia7eef70a5d06b8b9afa1f1fbb0ed1dbc21a3059f --- java/src/com/android/inputmethod/latin/LastComposedWord.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/LastComposedWord.java') diff --git a/java/src/com/android/inputmethod/latin/LastComposedWord.java b/java/src/com/android/inputmethod/latin/LastComposedWord.java index bb39ce4f7..dd73a978c 100644 --- a/java/src/com/android/inputmethod/latin/LastComposedWord.java +++ b/java/src/com/android/inputmethod/latin/LastComposedWord.java @@ -38,12 +38,12 @@ public class LastComposedWord { // an auto-correction. public static final int COMMIT_TYPE_CANCEL_AUTO_CORRECT = 3; - public static final int NOT_A_SEPARATOR = -1; + public static final String NOT_A_SEPARATOR = ""; public final int[] mPrimaryKeyCodes; public final String mTypedWord; public final String mCommittedWord; - public final int mSeparatorCode; + public final String mSeparatorString; public final CharSequence mPrevWord; public final InputPointers mInputPointers = new InputPointers(BinaryDictionary.MAX_WORD_LENGTH); @@ -56,14 +56,14 @@ public class LastComposedWord { // immutable. Do not fiddle with their contents after you passed them to this constructor. public LastComposedWord(final int[] primaryKeyCodes, final InputPointers inputPointers, final String typedWord, final String committedWord, - final int separatorCode, final CharSequence prevWord) { + final String separatorString, final CharSequence prevWord) { mPrimaryKeyCodes = primaryKeyCodes; if (inputPointers != null) { mInputPointers.copy(inputPointers); } mTypedWord = typedWord; mCommittedWord = committedWord; - mSeparatorCode = separatorCode; + mSeparatorString = separatorString; mActive = true; mPrevWord = prevWord; } @@ -80,7 +80,7 @@ public class LastComposedWord { return TextUtils.equals(mTypedWord, mCommittedWord); } - public static int getSeparatorLength(final int separatorCode) { - return NOT_A_SEPARATOR == separatorCode ? 0 : 1; + public static int getSeparatorLength(final String separatorString) { + return StringUtils.codePointCount(separatorString); } } -- cgit v1.2.3-83-g751a