diff options
author | 2013-04-15 04:24:01 -0700 | |
---|---|---|
committer | 2013-04-15 04:24:01 -0700 | |
commit | 34676d92cc08c5575995a36cef1df9c50c1facca (patch) | |
tree | b05b41da96876e5f3d685c13ca0de4001ea3c57d /java/src/com/android/inputmethod/latin/WordComposer.java | |
parent | d55ccbf7f95bb1af2d0b4a60994fb05af502e325 (diff) | |
parent | a022c53882642d1669e229f4f1b8d649c09447f7 (diff) | |
download | latinime-34676d92cc08c5575995a36cef1df9c50c1facca.tar.gz latinime-34676d92cc08c5575995a36cef1df9c50c1facca.tar.xz latinime-34676d92cc08c5575995a36cef1df9c50c1facca.zip |
am a022c538: Merge "If there are no suggestion span, recompute suggestions."
* commit 'a022c53882642d1669e229f4f1b8d649c09447f7':
If there are no suggestion span, recompute suggestions.
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) { |