aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-05-12 18:04:43 +0900
committerKeisuke Kuroyanagi <ksk@google.com>2014-05-12 18:04:43 +0900
commitddacfdeb090949383f5e22b96500563d944abe40 (patch)
tree91a784bb0b3b68d5867e5181b58d47437c0f4d23 /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
parente3e331aebbb493699563892e9d747102a96dffdb (diff)
downloadlatinime-ddacfdeb090949383f5e22b96500563d944abe40.tar.gz
latinime-ddacfdeb090949383f5e22b96500563d944abe40.tar.xz
latinime-ddacfdeb090949383f5e22b96500563d944abe40.zip
Improve multi-word suggestion handling for user history.
Bug: 12902664 Change-Id: I03deed16047f0beaba8932d87c6129ec8061ba9c
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 75432fbac..127db8dd9 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -588,7 +588,7 @@ public final class InputLogic {
if (null != candidate
&& mSuggestedWords.mSequenceNumber >= mAutoCommitSequenceNumber) {
if (candidate.mSourceDict.shouldAutoCommit(candidate)) {
- final String[] commitParts = candidate.mWord.split(" ", 2);
+ final String[] commitParts = candidate.mWord.split(Constants.WORD_SEPARATOR, 2);
batchPointers.shift(candidate.mIndexOfTouchPointOfSecondWord);
promotePhantomSpace(settingsValues);
mConnection.commitText(commitParts[0], 0);
@@ -1946,10 +1946,11 @@ public final class InputLogic {
final CharSequence chosenWordWithSuggestions =
SuggestionSpanUtils.getTextWithSuggestionSpan(mLatinIME, chosenWord,
suggestedWords);
- mConnection.commitText(chosenWordWithSuggestions, 1);
- // TODO: we pass 2 here, but would it be better to move this above and pass 1 instead?
+ // Use the 2nd previous word as the previous word because the 1st previous word is the word
+ // to be committed.
final String prevWord = mConnection.getNthPreviousWord(
settingsValues.mSpacingAndPunctuations, 2);
+ mConnection.commitText(chosenWordWithSuggestions, 1);
// Add the word to the user history dictionary
performAdditionToUserHistoryDictionary(settingsValues, chosenWord, prevWord);
// TODO: figure out here if this is an auto-correct or if the best word is actually