diff options
author | 2011-12-13 22:06:02 +0900 | |
---|---|---|
committer | 2011-12-13 23:15:12 +0900 | |
commit | 7b5bc1ff4d4694045e69e6aff8a2b5365ff882d1 (patch) | |
tree | b51e297ecdd82d5fecd61bad011765f2bf66572b /java/src | |
parent | edf4995a3bad3b95a2b4184d47ea4ff890d0de73 (diff) | |
download | latinime-7b5bc1ff4d4694045e69e6aff8a2b5365ff882d1.tar.gz latinime-7b5bc1ff4d4694045e69e6aff8a2b5365ff882d1.tar.xz latinime-7b5bc1ff4d4694045e69e6aff8a2b5365ff882d1.zip |
Decouple member logic from control flow
This place is very confusing because a member variable with
a consistent meaning is hijacked for the duration of a function
to mean something else. This is in the way of easy-to-understand
refactoring.
Change-Id: If79bc771950d6bfc0ad5f0e9c51c7ef1dbb45b66
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 2d7eed7ab..21165d028 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1510,13 +1510,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (null != ic) removeTrailingSpaceWhileInBatchEdit(ic); } + boolean isComposingWord = mHasUncommittedTypedChars; int code = primaryCode; if ((isAlphabet(code) || mSettingsValues.isSymbolExcludedFromWordSeparators(code)) && isSuggestionsRequested() && !isCursorTouchingWord()) { - if (!mHasUncommittedTypedChars) { + if (!isComposingWord) { // 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); + // the character is a single quote. The idea here is, single quote is not a + // separator and it should be treated as a normal character, except in the first + // position where it should not start composing a word. + isComposingWord = (Keyboard.CODE_SINGLE_QUOTE != code); mWordComposer.reset(); clearSuggestions(); mComposingStateManager.onFinishComposingText(); @@ -1543,7 +1546,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } } - if (mHasUncommittedTypedChars) { + if (isComposingWord) { + mHasUncommittedTypedChars = true; mWordComposer.add(code, keyCodes, x, y); if (ic != null) { // If it's the first letter, make note of auto-caps state |