diff options
author | 2014-04-29 11:34:28 -0700 | |
---|---|---|
committer | 2014-04-29 11:34:28 -0700 | |
commit | 2debf168920bb852b1583446fc336743f98b3c04 (patch) | |
tree | 7324a335fb65fcc585695d7d061b04aeba64be10 /java/src/com/android/inputmethod/latin/RichInputConnection.java | |
parent | 5c36065b74852857b3cc520d7be5df9413937cd9 (diff) | |
parent | 5df8b42709662b0e599019e4fd17c4e153ff6b47 (diff) | |
download | latinime-2debf168920bb852b1583446fc336743f98b3c04.tar.gz latinime-2debf168920bb852b1583446fc336743f98b3c04.tar.xz latinime-2debf168920bb852b1583446fc336743f98b3c04.zip |
Merge commit '5df8b42709662b0e599019e4fd17c4e153ff6b47' into HEAD
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/RichInputConnection.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index c212f9c81..673d1b4c2 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -61,7 +61,7 @@ public final class RichInputConnection { * cursor may end up after all the keyboard-triggered updates have passed. We keep this to * compare it to the actual cursor position to guess whether the move was caused by a * keyboard command or not. - * It's not really the cursor position: the cursor may not be there yet, and it's also expected + * It's not really the cursor position: the cursor may not be there yet, and it's also expected * there be cases where it never actually comes to be there. */ private int mExpectedCursorPosition = INVALID_CURSOR_POSITION; // in chars, not code points @@ -292,7 +292,11 @@ public final class RichInputConnection { mCommittedTextBeforeComposingText.length() + mComposingText.length(); // If we have enough characters to satisfy the request, or if we have all characters in // the text field, then we can return the cached version right away. - if (cachedLength >= n || cachedLength >= mExpectedCursorPosition) { + // However, if we don't have an expected cursor position, then we should always + // go fetch the cache again (as it happens, INVALID_CURSOR_POSITION < 0, so we need to + // test for this explicitly) + if (INVALID_CURSOR_POSITION != mExpectedCursorPosition + && (cachedLength >= n || cachedLength >= mExpectedCursorPosition)) { final StringBuilder s = new StringBuilder(mCommittedTextBeforeComposingText); // We call #toString() here to create a temporary object. // In some situations, this method is called on a worker thread, and it's possible |