aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-01-09 18:37:10 +0900
committerJean Chalard <jchalard@google.com>2013-01-09 18:37:10 +0900
commit516b63db2866f144a00ec7e1e6c29cb0865f5ff3 (patch)
tree758425ca166f3a4562e83f0eed32cc6b987468a4 /java/src
parent8315e8168b135599237f5493f72e667f39503006 (diff)
downloadlatinime-516b63db2866f144a00ec7e1e6c29cb0865f5ff3.tar.gz
latinime-516b63db2866f144a00ec7e1e6c29cb0865f5ff3.tar.xz
latinime-516b63db2866f144a00ec7e1e6c29cb0865f5ff3.zip
Fix a race condition with backspaces
And add a test to make sure it stays not-broken. Bug: 7946604 Change-Id: I996da3d5507d591ec25a13fb57434f39843f1df5
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 6eeee9c2a..3b0112b27 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1717,6 +1717,11 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// If there is a selection, remove it.
final int lengthToDelete = mLastSelectionEnd - mLastSelectionStart;
mConnection.setSelection(mLastSelectionEnd, mLastSelectionEnd);
+ // Reset mLastSelectionEnd to mLastSelectionStart. This is what is supposed to
+ // happen, and if it's wrong, the next call to onUpdateSelection will correct it,
+ // but we want to set it right away to avoid it being used with the wrong values
+ // later (typically, in a subsequent press on backspace).
+ mLastSelectionEnd = mLastSelectionStart;
mConnection.deleteSurroundingText(lengthToDelete, 0);
} else {
// There is no selection, just delete one character.