diff options
author | 2013-11-13 14:20:45 +0900 | |
---|---|---|
committer | 2013-11-12 22:44:59 -0800 | |
commit | 3a9b2430a56cb2d774070bd8ecd661d0dfb82484 (patch) | |
tree | f578d3435ef7c03143d7a3b18bc8fecb5d207a33 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | a5f5ab84c0d5d37b68c89addb9de5aa4d5ab6ca6 (diff) | |
download | latinime-3a9b2430a56cb2d774070bd8ecd661d0dfb82484.tar.gz latinime-3a9b2430a56cb2d774070bd8ecd661d0dfb82484.tar.xz latinime-3a9b2430a56cb2d774070bd8ecd661d0dfb82484.zip |
Fix many small nits.
...the interaction of which results in a very bad bug.
Bug: 11648854
Change-Id: I774489e384388f187e72b9ac091ab387c5e1a79a
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 91faf4802..0f883245f 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -910,6 +910,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen false /* shouldFinishComposition */)) { // We try resetting the caches up to 5 times before giving up. mHandler.postResetCaches(isDifferentTextField, 5 /* remainingTries */); + // mLastSelection{Start,End} are reset later in this method, don't need to do it here canReachInputConnection = false; } else { if (isDifferentTextField) { @@ -989,10 +990,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (textLength > mLastSelectionStart || (textLength < Constants.EDITOR_CONTENTS_CACHE_SIZE && mLastSelectionStart < Constants.EDITOR_CONTENTS_CACHE_SIZE)) { + // It should not be possible to have only one of those variables be + // NOT_A_CURSOR_POSITION, so if they are equal, either the selection is zero-sized + // (simple cursor, no selection) or there is no cursor/we don't know its pos + final boolean wasEqual = mLastSelectionStart == mLastSelectionEnd; mLastSelectionStart = textLength; // We can't figure out the value of mLastSelectionEnd :( - // But at least if it's smaller than mLastSelectionStart something is wrong - if (mLastSelectionStart > mLastSelectionEnd) { + // But at least if it's smaller than mLastSelectionStart something is wrong, + // and if they used to be equal we also don't want to make it look like there is a + // selection. + if (wasEqual || mLastSelectionStart > mLastSelectionEnd) { mLastSelectionEnd = mLastSelectionStart; } } |