diff options
author | 2013-12-13 20:42:29 +0900 | |
---|---|---|
committer | 2013-12-13 20:51:28 +0900 | |
commit | fae1ba767ca177510adc08b363987f67bbf40d90 (patch) | |
tree | 766cf7f7679fc11832fc3d56528056c099d26575 /java/src/com/android/inputmethod/latin/WordComposer.java | |
parent | a245d15da5d295af21ead9a01583c64796a31ad7 (diff) | |
download | latinime-fae1ba767ca177510adc08b363987f67bbf40d90.tar.gz latinime-fae1ba767ca177510adc08b363987f67bbf40d90.tar.xz latinime-fae1ba767ca177510adc08b363987f67bbf40d90.zip |
Don't use the previous word after a non-whitespace separator
Bug: 12101276
Change-Id: Icf36d55ec171194e5561b946021bcf648782ddd4
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/WordComposer.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index 2f81d15d5..5ecfc67b2 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -471,7 +471,12 @@ public final class WordComposer { mCapsCount = 0; mDigitsCount = 0; mIsBatchMode = false; - mPreviousWord = mTypedWord.toString(); + final boolean isWhitespace = 1 == StringUtils.codePointCount(separatorString) + && Character.isWhitespace(separatorString.codePointAt(0)); + // If not whitespace, we don't use the previous word for suggestion. This is consistent + // with how we get the previous word for suggestion: see RichInputConnection#spaceRegex and + // LatinIME#getNthPreviousWordForSuggestion. + mPreviousWord = isWhitespace ? mTypedWord.toString() : null; mTypedWord.setLength(0); mCodePointSize = 0; mTrailingSingleQuotesCount = 0; @@ -485,6 +490,13 @@ public final class WordComposer { return lastComposedWord; } + public void doubleSpacePeriod() { + // When a period was entered with a double space, the separator we got has been + // changed by a period (see #commitWord). We should not use the previous word for + // suggestion. + mPreviousWord = null; + } + public void resumeSuggestionOnLastComposedWord(final LastComposedWord lastComposedWord, final String previousWord) { mPrimaryKeyCodes = lastComposedWord.mPrimaryKeyCodes; |