aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-01-19 01:57:08 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-01-19 01:57:08 -0800
commitdb6c706ae58dfc2e1b62a11666fdd1b3d8ad9968 (patch)
tree1b8a4349f774e95705eb45279699dfc85a11fd86 /java/src
parentbd31f2d2ee3bdf07373a1767f28278c51a21225e (diff)
parent250cf0a781258afbfe45b8a7ad411aed08b3e873 (diff)
downloadlatinime-db6c706ae58dfc2e1b62a11666fdd1b3d8ad9968.tar.gz
latinime-db6c706ae58dfc2e1b62a11666fdd1b3d8ad9968.tar.xz
latinime-db6c706ae58dfc2e1b62a11666fdd1b3d8ad9968.zip
am 250cf0a7: Merge "Fix a bug with backspace happening after a manual pick."
* commit '250cf0a781258afbfe45b8a7ad411aed08b3e873': Fix a bug with backspace happening after a manual pick.
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 5b4b31b10..d36140de6 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -2154,6 +2154,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// "ic" must not be null
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic) {
+ // Note: this relies on the last word still being held in the WordComposer, in
+ // the field for suggestion resuming.
+ // Note: in the interest of code simplicity, we may want to just call
+ // restartSuggestionsOnWordBeforeCursorIfAtEndOfWord instead, but retrieving
+ // the old WordComposer allows to reuse the actual typed coordinates.
+ mWordComposer.resumeSuggestionOnKeptWord();
+ // We resume suggestion, and then we want to set the composing text to the content
+ // of the word composer again. But since we just manually picked a word, there is
+ // no composing text at the moment, so we have to delete the word before we set a
+ // new composing text.
final int restartLength = mWordComposer.size();
if (DEBUG) {
final String wordBeforeCursor =
@@ -2167,13 +2177,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
+ wordBeforeCursor + "\"");
}
}
+ // Warning: this +1 takes into account the extra space added by the manual pick process.
ic.deleteSurroundingText(restartLength + 1, 0);
-
- // Note: this relies on the last word still being held in the WordComposer
- // Note: in the interest of code simplicity, we may want to just call
- // restartSuggestionsOnWordBeforeCursorIfAtEndOfWord instead, but retrieving
- // the old WordComposer allows to reuse the actual typed coordinates.
- mWordComposer.resumeSuggestionOnKeptWord();
ic.setComposingText(mWordComposer.getTypedWord(), 1);
mHandler.cancelUpdateBigramPredictions();
mHandler.postUpdateSuggestions();