aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-01-18 15:48:29 +0900
committerTadashi G. Takaoka <takaoka@google.com>2011-01-18 21:01:26 +0900
commit30be3f9845c7b1d5ae14036f816e0f7c55939f37 (patch)
tree8c76004413b1c93efbda10d33f1d858495c4aa23 /java/src
parentd5a6b910e83de6dea3c5813cbf5e219abaccdf8a (diff)
downloadlatinime-30be3f9845c7b1d5ae14036f816e0f7c55939f37.tar.gz
latinime-30be3f9845c7b1d5ae14036f816e0f7c55939f37.tar.xz
latinime-30be3f9845c7b1d5ae14036f816e0f7c55939f37.zip
Clear composing text when the auto-corrected word is reverted
Bug: 3363133 Change-Id: Ib7582ad354ba16eb8ebc9f0b4f51c8ec3790f578
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index cd4143e78..93d5ef616 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1805,7 +1805,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final int length = mComposing.length();
if (!mHasValidSuggestions && length > 0) {
final InputConnection ic = getCurrentInputConnection();
- mHasValidSuggestions = true;
mJustReverted = true;
final CharSequence punctuation = ic.getTextBeforeCursor(1, 0);
if (deleteChar) ic.deleteSurroundingText(1, 0);
@@ -1815,14 +1814,19 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
toDelete--;
}
ic.deleteSurroundingText(toDelete, 0);
- if (deleteChar) {
+ // Re-insert punctuation only when the deleted character was word separator and the
+ // composing text wasn't equal to the auto-corrected text.
+ if (deleteChar
+ && !TextUtils.isEmpty(punctuation) && isWordSeparator(punctuation.charAt(0))
+ && !TextUtils.equals(mComposing, toTheLeft)) {
ic.commitText(mComposing, 1);
TextEntryState.acceptedTyped(mComposing);
- if (!TextUtils.isEmpty(punctuation) && isWordSeparator(punctuation.charAt(0))) {
- ic.commitText(punctuation, 1);
- TextEntryState.typedCharacter(punctuation.charAt(0), true);
- }
+ ic.commitText(punctuation, 1);
+ TextEntryState.typedCharacter(punctuation.charAt(0), true);
+ // Clear composing text
+ mComposing.setLength(0);
} else {
+ mHasValidSuggestions = true;
ic.setComposingText(mComposing, 1);
TextEntryState.backspace();
}