diff options
author | 2011-07-13 12:00:06 +0900 | |
---|---|---|
committer | 2011-07-13 12:15:22 +0900 | |
commit | 84cb23a789aa0f89b7809dee4625d1916c1bb2f3 (patch) | |
tree | eeeda2ec158f5ef0f9e64f936e340e8b5a38ebf4 /java/src | |
parent | 656a35f9dfab5f62b484cfff5779ec3cd76dbb2c (diff) | |
download | latinime-84cb23a789aa0f89b7809dee4625d1916c1bb2f3.tar.gz latinime-84cb23a789aa0f89b7809dee4625d1916c1bb2f3.tar.xz latinime-84cb23a789aa0f89b7809dee4625d1916c1bb2f3.zip |
Small code cleanup
Change-Id: I7075d85f745c3b186e6d06086b9fcd54e7459feb
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index cec30eaab..53dce7191 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1803,19 +1803,18 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final InputConnection ic = getCurrentInputConnection(); final CharSequence punctuation = ic.getTextBeforeCursor(1, 0); if (deleteChar) ic.deleteSurroundingText(1, 0); - int toDelete = mCommittedLength; - final CharSequence toTheLeft = ic.getTextBeforeCursor(mCommittedLength, 0); - if (!TextUtils.isEmpty(toTheLeft) - && mSettingsValues.isWordSeparator(toTheLeft.charAt(0))) { - toDelete--; - } - ic.deleteSurroundingText(toDelete, 0); + final CharSequence textToTheLeft = ic.getTextBeforeCursor(mCommittedLength, 0); + final int toDeleteLength = (!TextUtils.isEmpty(textToTheLeft) + && mSettingsValues.isWordSeparator(toTheLeft.charAt(0))) + ? mCommittedLength - 1 : mCommittedLength; + ic.deleteSurroundingText(toDeleteLength, 0); + // 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) && mSettingsValues.isWordSeparator(punctuation.charAt(0)) - && !TextUtils.equals(mComposingStringBuilder, toTheLeft)) { + && !TextUtils.equals(mComposingStringBuilder, textToTheLeft)) { ic.commitText(mComposingStringBuilder, 1); TextEntryState.acceptedTyped(mComposingStringBuilder); ic.commitText(punctuation, 1); |