diff options
author | 2011-10-07 05:46:32 -0700 | |
---|---|---|
committer | 2011-10-07 05:46:32 -0700 | |
commit | f6d4efe4ac58666ea4e6165084ef1369a8e0e1af (patch) | |
tree | 3325e833d4510cdde5a9fc5b0d182c669e47beb2 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | 158f1cce3da9872e089c5d94530d17bfde831b85 (diff) | |
parent | 266ae6964d5bcab82e10f6ba7fe36f38da0c086d (diff) | |
download | latinime-f6d4efe4ac58666ea4e6165084ef1369a8e0e1af.tar.gz latinime-f6d4efe4ac58666ea4e6165084ef1369a8e0e1af.tar.xz latinime-f6d4efe4ac58666ea4e6165084ef1369a8e0e1af.zip |
am 266ae696: Merge "Fix a bug with the whitelist"
* commit '266ae6964d5bcab82e10f6ba7fe36f38da0c086d':
Fix a bug with the whitelist
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 892e5f558..3b311377b 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1635,11 +1635,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar boolean autoCorrectionAvailable = !mInputTypeNoAutoCorrect && mSuggest.hasAutoCorrection(); final CharSequence typedWord = wordComposer.getTypedWord(); // Here, we want to promote a whitelisted word if exists. - final boolean typedWordValid = AutoCorrection.isValidWordForAutoCorrection( + // 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( mSuggest.getUnigramDictionaries(), typedWord, preferCapitalization()); if (mCorrectionMode == Suggest.CORRECTION_FULL || mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM) { - autoCorrectionAvailable |= typedWordValid; + autoCorrectionAvailable |= (!allowsToBeAutoCorrected); } // Don't auto-correct words with multiple capital letter autoCorrectionAvailable &= !wordComposer.isMostlyCaps(); @@ -1652,9 +1657,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // need to clear the previous state when the user starts typing a word (i.e. typed word's // length == 1). if (typedWord != null) { - if (builder.size() > 1 || typedWord.length() == 1 || typedWordValid + if (builder.size() > 1 || typedWord.length() == 1 || (!allowsToBeAutoCorrected) || mSuggestionsView.isShowingAddToDictionaryHint()) { - builder.setTypedWordValid(typedWordValid).setHasMinimalSuggestion( + builder.setTypedWordValid(!allowsToBeAutoCorrected).setHasMinimalSuggestion( autoCorrectionAvailable); } else { SuggestedWords previousSuggestions = mSuggestionsView.getSuggestions(); |