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 11:11:15 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-12 11:11:15 +0000
commit84070cbc74cb75a86cf5b995fe50ce53790b17d3 (patch)
tree9e992698db23cddb4ae69226db71fac5de8d40d3 /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
parent6b1160f899782edc7619ad2a56bb2a5a1645994b (diff)
parentddacfdeb090949383f5e22b96500563d944abe40 (diff)
downloadlatinime-84070cbc74cb75a86cf5b995fe50ce53790b17d3.tar.gz
latinime-84070cbc74cb75a86cf5b995fe50ce53790b17d3.tar.xz
latinime-84070cbc74cb75a86cf5b995fe50ce53790b17d3.zip
Merge "Improve multi-word suggestion handling for user history."
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 e80ee35bd..6a420748c 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -604,7 +604,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);
@@ -1962,10 +1962,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