diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index b6a7ce74a..4773ac55a 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -282,6 +282,14 @@ public class Suggest implements Dictionary.WordCallback { Dictionary.UNIGRAM); mConsideredWord = consideredWord; + // TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid" + // but still autocorrected from - in the case the whitelist only capitalizes the word. + // The whitelist should be case-insensitive, so it's not possible to be consistent with + // a boolean flag. Right now this is handled with a slight hack in + // WhitelistDictionary#shouldForciblyAutoCorrectFrom. + final boolean allowsToBeAutoCorrected = AutoCorrection.allowsToBeAutoCorrected( + getUnigramDictionaries(), consideredWord, wordComposer.isFirstCharCapitalized()); + if (wordComposer.size() <= 1 && (correctionMode == CORRECTION_FULL_BIGRAM)) { // At first character typed, search only the bigrams Arrays.fill(mBigramScores, 0); @@ -393,9 +401,11 @@ public class Suggest implements Dictionary.WordCallback { for (int i = mScores.length; i < mSuggestions.size(); ++i) { scoreInfoList.add(new SuggestedWords.SuggestedWordInfo("--", false)); } - return new SuggestedWords.Builder().addWords(mSuggestions, scoreInfoList); + return new SuggestedWords.Builder().addWords(mSuggestions, scoreInfoList) + .setAllowsToBeAutoCorrected(allowsToBeAutoCorrected); } - return new SuggestedWords.Builder().addWords(mSuggestions, null); + return new SuggestedWords.Builder().addWords(mSuggestions, null) + .setAllowsToBeAutoCorrected(allowsToBeAutoCorrected); } public boolean hasAutoCorrection() { |