From 6d1cbbc2ffb9d7046189174ec68b5b72bbc154b3 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Tue, 22 Nov 2011 18:29:51 +0900 Subject: [PATCH] Fix a bug with single quotes I14dd3815 special-cased single quotes at the start of a word, but did not do so correctly - it would kill a composing word if entered just after some punctuations. The right test was not isCursorTouchingWord() but mHasUncommittedTypedChars, which actually makes for a simpler implementation. Bug: 5648032 Change-Id: Icd21d213e0cad6da68cacfeb921502cd8dcfac95 --- java/src/com/android/inputmethod/latin/LatinIME.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index dc5ec2d86..f4a1c6a1d 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1539,16 +1539,15 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if ((isAlphabet(code) || mSettingsValues.isSymbolExcludedFromWordSeparators(code)) && isSuggestionsRequested() && !isCursorTouchingWord()) { if (!mHasUncommittedTypedChars) { - mHasUncommittedTypedChars = true; + // Reset entirely the composing state anyway, then start composing a new word unless + // the character is a single quote. + mHasUncommittedTypedChars = (Keyboard.CODE_SINGLE_QUOTE != code); mComposingStringBuilder.setLength(0); mWordComposer.reset(); clearSuggestions(); mComposingStateManager.onFinishComposingText(); } } - if (code == Keyboard.CODE_SINGLE_QUOTE && !isCursorTouchingWord()) { - mHasUncommittedTypedChars = false; - } final KeyboardSwitcher switcher = mKeyboardSwitcher; if (switcher.isShiftedOrShiftLocked()) { if (keyCodes == null || keyCodes[0] < Character.MIN_CODE_POINT