aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-12-16 06:58:48 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2013-12-16 06:58:48 -0800
commit30dafcd088785929d9847a1f83e7ca4bbb136623 (patch)
tree97c9f008250b6e8a361e31c957df8b28c08e1db7 /java/src/com/android/inputmethod/latin/LatinIME.java
parent222fc6588183e84d4ffc0ea5a9f1fa1ba31725fb (diff)
parent0c7b05fc50edaae5c4e079410dfc7eb8cd14261c (diff)
downloadlatinime-30dafcd088785929d9847a1f83e7ca4bbb136623.tar.gz
latinime-30dafcd088785929d9847a1f83e7ca4bbb136623.tar.xz
latinime-30dafcd088785929d9847a1f83e7ca4bbb136623.zip
am 0c7b05fc: Merge "Fix a bug with languages without spaces and predictions"
* commit '0c7b05fc50edaae5c4e079410dfc7eb8cd14261c': Fix a bug with languages without spaces and predictions
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 1f6091e90..72d5435a8 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1469,7 +1469,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
ResearchLogger.latinIME_maybeDoubleSpacePeriod(textToInsert,
false /* isBatchMode */);
}
- mWordComposer.doubleSpacePeriod();
+ mWordComposer.discardPreviousWordForSuggestion();
mKeyboardSwitcher.updateShiftState();
return true;
}
@@ -2567,7 +2567,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (DEBUG) {
if (mWordComposer.isComposingWord() || mWordComposer.isBatchMode()) {
- final String previousWord = mWordComposer.getPreviousWord();
+ final String previousWord = mWordComposer.getPreviousWordForSuggestion();
// TODO: this is for checking consistency with older versions. Remove this when
// we are confident this is stable.
// We're checking the previous word in the text field against the memorized previous
@@ -2581,7 +2581,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
}
- suggest.getSuggestedWords(mWordComposer, mWordComposer.getPreviousWord(),
+ suggest.getSuggestedWords(mWordComposer, mWordComposer.getPreviousWordForSuggestion(),
keyboard.getProximityInfo(),
currentSettings.mBlockPotentiallyOffensive, currentSettings.mCorrectionEnabled,
additionalFeaturesOptions, sessionId, sequenceNumber, callback);
@@ -2824,6 +2824,19 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// strings.
mLastComposedWord = mWordComposer.commitWord(commitType, chosenWord, separatorString,
prevWord);
+ final boolean shouldDiscardPreviousWordForSuggestion;
+ if (0 == StringUtils.codePointCount(separatorString)) {
+ // Separator is 0-length. Discard the word only if the current language has spaces.
+ shouldDiscardPreviousWordForSuggestion =
+ mSettings.getCurrent().mCurrentLanguageHasSpaces;
+ } else {
+ // Otherwise, we discard if the separator contains any non-whitespace.
+ shouldDiscardPreviousWordForSuggestion =
+ !StringUtils.containsOnlyWhitespace(separatorString);
+ }
+ if (shouldDiscardPreviousWordForSuggestion) {
+ mWordComposer.discardPreviousWordForSuggestion();
+ }
}
private void setPunctuationSuggestions() {