aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-11-13 06:10:38 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-11-13 06:10:39 +0000
commitb87ed46118c4bdf34c764a1e93c2cf0d4655f63b (patch)
treedcc1f11e9d3f4e46f3e8d945934354cb9c9441ac /java/src/com/android/inputmethod/latin/LatinIME.java
parentfe05173198ebd01ff65b8e29e720791ad40a0fa6 (diff)
parent5a0bc6ac69fc2b2a274241404f04c44745f01c5a (diff)
downloadlatinime-b87ed46118c4bdf34c764a1e93c2cf0d4655f63b.tar.gz
latinime-b87ed46118c4bdf34c764a1e93c2cf0d4655f63b.tar.xz
latinime-b87ed46118c4bdf34c764a1e93c2cf0d4655f63b.zip
Merge "Fix many small nits."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java11
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 745fb43d6..26b35bf0c 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -908,6 +908,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) {
@@ -987,10 +988,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;
}
}