aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/WordComposer.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-04-15 11:18:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-04-15 11:18:27 +0000
commita022c53882642d1669e229f4f1b8d649c09447f7 (patch)
treeb05b41da96876e5f3d685c13ca0de4001ea3c57d /java/src/com/android/inputmethod/latin/WordComposer.java
parent837f46dcb35a8f42a6bd5bc5fc6395d7386acb81 (diff)
parent0e9ee4d3bf75459560670ca5c28ff4c4f7c346fb (diff)
downloadlatinime-a022c53882642d1669e229f4f1b8d649c09447f7.tar.gz
latinime-a022c53882642d1669e229f4f1b8d649c09447f7.tar.xz
latinime-a022c53882642d1669e229f4f1b8d649c09447f7.zip
Merge "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.java16
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) {