diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index dc5ec2d86aa6601e890b0ab474c21ecfacae37a1..f4a1c6a1d6711c3a799f7ca7328a2cf36c544989 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