aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-12-16 14:17:50 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-12-16 14:17:51 +0000
commit0c7b05fc50edaae5c4e079410dfc7eb8cd14261c (patch)
tree97c9f008250b6e8a361e31c957df8b28c08e1db7 /java/src/com/android/inputmethod/latin/LatinIME.java
parente17cc8270f280e998a7500abd375b8870e07af65 (diff)
parent7cd7cf73f4ce6f0e577d6382eb0fc25f60dc63e1 (diff)
downloadlatinime-0c7b05fc50edaae5c4e079410dfc7eb8cd14261c.tar.gz
latinime-0c7b05fc50edaae5c4e079410dfc7eb8cd14261c.tar.xz
latinime-0c7b05fc50edaae5c4e079410dfc7eb8cd14261c.zip
Merge "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() {