diff options
author | 2013-01-11 20:31:09 +0900 | |
---|---|---|
committer | 2013-01-18 15:05:34 +0900 | |
commit | e3ec5fcc88513a4141577e5b2001b3896e111232 (patch) | |
tree | 916c97225300c066dde91fb750a9f1565df865e6 /java/src | |
parent | e6a9655a0362bebccdf0d51ebc3579573617c95a (diff) | |
download | latinime-e3ec5fcc88513a4141577e5b2001b3896e111232.tar.gz latinime-e3ec5fcc88513a4141577e5b2001b3896e111232.tar.xz latinime-e3ec5fcc88513a4141577e5b2001b3896e111232.zip |
Fix a bug in gesture after a dash or apostrophe
It would insert a space when it shouldn't when composing a
word ending in either dash or apostrophe and gesturing right
away.
Bug: 7889078
Change-Id: Ib3e2f6f5e551888cc081b464a641e2deac6f5ef7
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d02c4df7e..64636d68f 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1476,7 +1476,10 @@ public final class LatinIME extends InputMethodService implements KeyboardAction Stats.onAutoCorrection("", mWordComposer.getTypedWord(), " ", mWordComposer); } } - if (mWordComposer.size() <= 1) { + final int wordComposerSize = mWordComposer.size(); + // Since isComposingWord() is true, the size is at least 1. + final int lastChar = mWordComposer.getCodeAt(wordComposerSize - 1); + if (wordComposerSize <= 1) { // We auto-correct the previous (typed, not gestured) string iff it's one character // long. The reason for this is, even in the middle of gesture typing, you'll still // tap one-letter words and you want them auto-corrected (typically, "i" in English @@ -1490,8 +1493,14 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } mExpectingUpdateSelection = true; // The following is necessary for the case where the user typed something but didn't - // manual pick it and didn't input any separator. - mSpaceState = SPACE_STATE_PHANTOM; + // manual pick it and didn't input any separator: we want to put a space between what + // has been entered and the coming gesture input result, so we go into phantom space + // state, which will be promoted to a space when the gesture result is committed. But if + // the current input ends in a word connector on the other hand, then we want to have + // the next input stick to the current input so we don't switch to phantom space state. + if (!mSettings.getCurrent().isWordConnector(lastChar)) { + mSpaceState = SPACE_STATE_PHANTOM; + } } else { final int codePointBeforeCursor = mConnection.getCodePointBeforeCursor(); if (mSettings.getCurrent().isUsuallyFollowedBySpace(codePointBeforeCursor)) { |