diff options
author | 2013-04-10 16:38:37 +0900 | |
---|---|---|
committer | 2013-04-12 20:49:03 +0900 | |
commit | 6a114fa700d3ca73c608e1291b74bbbdd5a1a7b7 (patch) | |
tree | 5e6ab1f85370bf2a426145e40fcc2cce243772c3 /java/src/com/android/inputmethod/latin/WordComposer.java | |
parent | d24f93971292451c7a16456fecb8eff5deaa2c37 (diff) | |
download | latinime-6a114fa700d3ca73c608e1291b74bbbdd5a1a7b7.tar.gz latinime-6a114fa700d3ca73c608e1291b74bbbdd5a1a7b7.tar.xz latinime-6a114fa700d3ca73c608e1291b74bbbdd5a1a7b7.zip |
Restart suggestions when the cursor moves.
This uses the old suggestions. It does not try to recompute
new suggestions if there are no old suggestions yet: this is
coming in a later change.
If there are no suggestions, this shows the word itself
as a suggestion.
Bug: 8084810
Change-Id: I4c2e25df0ff3673be1825f57a0c19a9d23d47a48
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/WordComposer.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index f7cb4346a..1af12428d 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -49,6 +49,7 @@ public final class WordComposer { private int mCapitalizedMode; private int mTrailingSingleQuotesCount; private int mCodePointSize; + private int mCursorPositionWithinWord; /** * Whether the user chose to capitalize the first char of the word. @@ -62,6 +63,7 @@ public final class WordComposer { mTrailingSingleQuotesCount = 0; mIsResumed = false; mIsBatchMode = false; + mCursorPositionWithinWord = 0; refreshSize(); } @@ -76,6 +78,7 @@ public final class WordComposer { mTrailingSingleQuotesCount = source.mTrailingSingleQuotesCount; mIsResumed = source.mIsResumed; mIsBatchMode = source.mIsBatchMode; + mCursorPositionWithinWord = source.mCursorPositionWithinWord; refreshSize(); } @@ -91,6 +94,7 @@ public final class WordComposer { mTrailingSingleQuotesCount = 0; mIsResumed = false; mIsBatchMode = false; + mCursorPositionWithinWord = 0; refreshSize(); } @@ -135,6 +139,7 @@ public final class WordComposer { final int newIndex = size(); mTypedWord.appendCodePoint(primaryCode); refreshSize(); + mCursorPositionWithinWord = mCodePointSize; if (newIndex < MAX_WORD_LENGTH) { mPrimaryKeyCodes[newIndex] = primaryCode >= Constants.CODE_SPACE ? Character.toLowerCase(primaryCode) : primaryCode; @@ -158,6 +163,14 @@ public final class WordComposer { mAutoCorrection = null; } + public void setCursorPositionWithinWord(final int posWithinWord) { + mCursorPositionWithinWord = posWithinWord; + } + + public boolean isCursorAtEndOfComposingWord() { + return mCursorPositionWithinWord == mCodePointSize; + } + public void setBatchInputPointers(final InputPointers batchPointers) { mInputPointers.set(batchPointers); mIsBatchMode = true; @@ -242,6 +255,7 @@ public final class WordComposer { ++mTrailingSingleQuotesCount; } } + mCursorPositionWithinWord = mCodePointSize; mAutoCorrection = null; } @@ -368,6 +382,7 @@ public final class WordComposer { mCapitalizedMode = CAPS_MODE_OFF; refreshSize(); mAutoCorrection = null; + mCursorPositionWithinWord = 0; mIsResumed = false; return lastComposedWord; } @@ -380,6 +395,7 @@ public final class WordComposer { refreshSize(); mCapitalizedMode = lastComposedWord.mCapitalizedMode; mAutoCorrection = null; // This will be filled by the next call to updateSuggestion. + mCursorPositionWithinWord = mCodePointSize; mIsResumed = true; } |