diff options
author | 2013-04-17 19:47:12 -0700 | |
---|---|---|
committer | 2013-04-17 19:47:12 -0700 | |
commit | 2532265d6a1b85cc318c06d010632584a9bc7a63 (patch) | |
tree | 4a669ff05db1f091651e161871e1866eef1bb9a0 /java/src/com/android/inputmethod/latin/WordComposer.java | |
parent | da9c04cd45ded0fe8b9860f7386c1a695d6a6026 (diff) | |
parent | 34676d92cc08c5575995a36cef1df9c50c1facca (diff) | |
download | latinime-2532265d6a1b85cc318c06d010632584a9bc7a63.tar.gz latinime-2532265d6a1b85cc318c06d010632584a9bc7a63.tar.xz latinime-2532265d6a1b85cc318c06d010632584a9bc7a63.zip |
am 34676d92: am a022c538: Merge "If there are no suggestion span, recompute suggestions."
* commit '34676d92cc08c5575995a36cef1df9c50c1facca':
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) { |