aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
diff options
context:
space:
mode:
authorAdrian Velicu <adrianv@google.com>2014-09-30 06:56:35 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-30 06:56:35 +0000
commit7ba79df1a521cd339a0c1e47e6b9c630e8d3fa26 (patch)
tree3d0edac27d56daf054dd8faccdd9237b38818fbf /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
parentc613c3e3b8a112bb00ccd6f9eabc3438a9562f9d (diff)
parent9586d69bdf90fe24a83c0c6ba22589f28ae6cd03 (diff)
downloadlatinime-7ba79df1a521cd339a0c1e47e6b9c630e8d3fa26.tar.gz
latinime-7ba79df1a521cd339a0c1e47e6b9c630e8d3fa26.tar.xz
latinime-7ba79df1a521cd339a0c1e47e6b9c630e8d3fa26.zip
am 9586d69b: Avoid double space when autocorrect is triggered
* commit '9586d69bdf90fe24a83c0c6ba22589f28ae6cd03': Avoid double space when autocorrect is triggered
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 27af1611a..d7e1eba8b 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -1591,6 +1591,10 @@ public final class InputLogic {
final String committedWordString = committedWord.toString();
final int cancelLength = committedWord.length();
final String separatorString = mLastComposedWord.mSeparatorString;
+ // If our separator is a space, we won't actually commit it,
+ // but set the space state to PHANTOM so that a space will be inserted
+ // on the next keypress
+ final boolean usePhantomSpace = separatorString.equals(Constants.STRING_SPACE);
// We want java chars, not codepoints for the following.
final int separatorLength = separatorString.length();
// TODO: should we check our saved separator against the actual contents of the text view?
@@ -1611,7 +1615,8 @@ public final class InputLogic {
if (!TextUtils.isEmpty(committedWord)) {
mDictionaryFacilitator.removeWordFromPersonalizedDicts(committedWordString);
}
- final String stringToCommit = originallyTypedWord + separatorString;
+ final String stringToCommit = originallyTypedWord +
+ (usePhantomSpace ? "" : separatorString);
final SpannableString textToCommit = new SpannableString(stringToCommit);
if (committedWord instanceof SpannableString) {
final SpannableString committedWordWithSuggestionSpans = (SpannableString)committedWord;
@@ -1663,6 +1668,9 @@ public final class InputLogic {
} else {
mConnection.commitText(textToCommit, 1);
}
+ if (usePhantomSpace) {
+ mSpaceState = SpaceState.PHANTOM;
+ }
} else {
// For languages without spaces, we revert the typed string but the cursor is flush
// with the typed word, so we need to resume suggestions right away.