diff options
author | 2013-04-10 18:30:11 +0900 | |
---|---|---|
committer | 2013-04-15 19:33:23 +0900 | |
commit | 0e9ee4d3bf75459560670ca5c28ff4c4f7c346fb (patch) | |
tree | 34a080015b3e3df7df78c809b7f957aeb0244ca3 /java/src/com/android/inputmethod/latin/WordComposer.java | |
parent | 059e084e983ce4a1440dc065f5167d278d8939e7 (diff) | |
download | latinime-0e9ee4d3bf75459560670ca5c28ff4c4f7c346fb.tar.gz latinime-0e9ee4d3bf75459560670ca5c28ff4c4f7c346fb.tar.xz latinime-0e9ee4d3bf75459560670ca5c28ff4c4f7c346fb.zip |
If there are no suggestion span, recompute suggestions.
Bug: 8084810
Change-Id: I1743c09c43ca6835bb2f607684b037bf17d36335
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, 14 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index 098e8ac7b..51bd901fb 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -27,6 +27,7 @@ import java.util.Arrays; */ public final class WordComposer { private static final int MAX_WORD_LENGTH = Constants.Dictionary.MAX_WORD_LENGTH; + private static final boolean DBG = LatinImeLogger.sDBG; public static final int CAPS_MODE_OFF = 0; // 1 is shift bit, 2 is caps bit, 4 is auto bit but this is just a convention as these bits @@ -132,6 +133,13 @@ public final class WordComposer { return mPrimaryKeyCodes[index]; } + public int getCodeBeforeCursor() { + if (mCursorPositionWithinWord < 1 || mCursorPositionWithinWord > mPrimaryKeyCodes.length) { + return Constants.NOT_A_CODE; + } + return mPrimaryKeyCodes[mCursorPositionWithinWord - 1]; + } + public InputPointers getInputPointers() { return mInputPointers; } @@ -177,8 +185,12 @@ public final class WordComposer { mCursorPositionWithinWord = posWithinWord; } - public boolean isCursorAtEndOfComposingWord() { - return mCursorPositionWithinWord == mCodePointSize; + public boolean isCursorFrontOrMiddleOfComposingWord() { + if (DBG && mCursorPositionWithinWord > mCodePointSize) { + throw new RuntimeException("Wrong cursor position : " + mCursorPositionWithinWord + + "in a word of size " + mCodePointSize); + } + return mCursorPositionWithinWord != mCodePointSize; } public void setBatchInputPointers(final InputPointers batchPointers) { |