aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-02-19 16:08:48 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-02-19 16:08:48 -0800
commit9dc0eeae55475c9d1a0321a3bb95d57d47097333 (patch)
treee76e1b45be45f853e3c4cfc2d78825cb582dbdb1 /java/src
parent3753a75c656d83264316206bb7d13564f08132c2 (diff)
parent1fead1d5f12928f90c723b5f7b88490cc7cd2a67 (diff)
downloadlatinime-9dc0eeae55475c9d1a0321a3bb95d57d47097333.tar.gz
latinime-9dc0eeae55475c9d1a0321a3bb95d57d47097333.tar.xz
latinime-9dc0eeae55475c9d1a0321a3bb95d57d47097333.zip
Merge "Read the initial selection value."
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java16
1 files changed, 5 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 730992b13..fb88f3c5f 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -769,6 +769,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// The EditorInfo might have a flag that affects fullscreen mode.
// Note: This call should be done by InputMethodService?
updateFullscreenMode();
+ mLastSelectionStart = editorInfo.initialSelStart;
+ mLastSelectionEnd = editorInfo.initialSelEnd;
mInputAttributes = new InputAttributes(editorInfo, isFullscreenMode());
mApplicationSpecifiedCompletions = null;
@@ -1465,18 +1467,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
ic.deleteSurroundingText(lengthToDelete, 0);
} else {
if (NOT_A_CURSOR_POSITION == mLastSelectionEnd) {
- // We don't know whether there is a selection or not. We just send a false
- // hardware key event and let TextView sort it out for us. The problem
- // here is, this is asynchronous with respect to the input connection
- // batch edit, so it may flicker. But this only ever happens if backspace
- // is pressed just after the IME is invoked, and then again only once.
- // TODO: add an API call that gets the selection indices. This is available
- // to the IME in the general case via onUpdateSelection anyway, and would
- // allow us to remove this race condition.
- sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
- } else {
- ic.deleteSurroundingText(1, 0);
+ // This should never happen.
+ Log.e(TAG, "Backspace when we don't know the selection position");
}
+ ic.deleteSurroundingText(1, 0);
if (mDeleteCount > DELETE_ACCELERATE_AT) {
ic.deleteSurroundingText(1, 0);
}