aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/WordComposer.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-01-15 19:21:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-01-15 19:21:06 +0000
commit118a4fc2b7fc4f0ba1de78eb0ef72b473a6ecfd5 (patch)
tree5070d6c205633f7d5be413981510c8739fce428a /java/src/com/android/inputmethod/latin/WordComposer.java
parent20a8a4a3d9844dc2437fd1ca6325559bb2c3a644 (diff)
parent4752b68f5a62ede099677bdea0514ba1d5082606 (diff)
downloadlatinime-118a4fc2b7fc4f0ba1de78eb0ef72b473a6ecfd5.tar.gz
latinime-118a4fc2b7fc4f0ba1de78eb0ef72b473a6ecfd5.tar.xz
latinime-118a4fc2b7fc4f0ba1de78eb0ef72b473a6ecfd5.zip
Merge "[IL56] Don't erase suggestions when reverting a commit."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r--java/src/com/android/inputmethod/latin/WordComposer.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index b4f2d1a58..ebf65630e 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -297,7 +297,7 @@ public final class WordComposer {
* the context is nil (typically, at start of text).
* @param keyboard the keyboard this is typed on, for coordinate info/proximity.
*/
- public void setComposingWord(final CharSequence word, final String previousWord,
+ public void setComposingWord(final CharSequence word, final CharSequence previousWord,
final Keyboard keyboard) {
reset();
final int length = word.length();
@@ -306,7 +306,7 @@ public final class WordComposer {
addKeyInfo(codePoint, keyboard);
}
mIsResumed = true;
- mPreviousWordForSuggestion = previousWord;
+ mPreviousWordForSuggestion = null == previousWord ? null : previousWord.toString();
}
/**
@@ -418,9 +418,9 @@ public final class WordComposer {
* @param previousWord the previous word as context for suggestions. May be null if none.
*/
public void setCapitalizedModeAndPreviousWordAtStartComposingTime(final int mode,
- final String previousWord) {
+ final CharSequence previousWord) {
mCapitalizedMode = mode;
- mPreviousWordForSuggestion = previousWord;
+ mPreviousWordForSuggestion = null == previousWord ? null : previousWord.toString();
}
/**
@@ -454,7 +454,8 @@ public final class WordComposer {
}
// `type' should be one of the LastComposedWord.COMMIT_TYPE_* constants above.
- public LastComposedWord commitWord(final int type, final String committedWord,
+ // committedWord should contain suggestion spans if applicable.
+ public LastComposedWord commitWord(final int type, final CharSequence committedWord,
final String separatorString, final String prevWord) {
// Note: currently, we come here whenever we commit a word. If it's a MANUAL_PICK
// or a DECIDED_WORD we may cancel the commit later; otherwise, we should deactivate
@@ -472,7 +473,7 @@ public final class WordComposer {
mCapsCount = 0;
mDigitsCount = 0;
mIsBatchMode = false;
- mPreviousWordForSuggestion = committedWord;
+ mPreviousWordForSuggestion = committedWord.toString();
mTypedWord.setLength(0);
mCodePointSize = 0;
mTrailingSingleQuotesCount = 0;