diff options
author | 2011-01-18 08:49:48 -0800 | |
---|---|---|
committer | 2011-01-18 08:49:48 -0800 | |
commit | 9b76ac088fb4109e465e2a3a91eb3077d16e6b6e (patch) | |
tree | d6c3fc79ac68a3e3187bd29cdd8c008550223d1f /java/src | |
parent | ef645b56067fc1c8b81b51c5ca946ee6e9d00afd (diff) | |
parent | 5e51f2be32cf9f57355ac77e9952d6d03ef92175 (diff) | |
download | latinime-9b76ac088fb4109e465e2a3a91eb3077d16e6b6e.tar.gz latinime-9b76ac088fb4109e465e2a3a91eb3077d16e6b6e.tar.xz latinime-9b76ac088fb4109e465e2a3a91eb3077d16e6b6e.zip |
am 5e51f2be: am 3f652e24: Merge "Clear composing text when the auto-corrected word is reverted" into honeycomb
* commit '5e51f2be32cf9f57355ac77e9952d6d03ef92175':
Clear composing text when the auto-corrected word is reverted
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 16 |
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(); } |