aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/WhitelistDictionary.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-10-07 02:50:11 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-07 02:50:11 -0700
commit266ae6964d5bcab82e10f6ba7fe36f38da0c086d (patch)
tree3325e833d4510cdde5a9fc5b0d182c669e47beb2 /java/src/com/android/inputmethod/latin/WhitelistDictionary.java
parentbeac24226b6a6303ff1821cf0ad57f146bb0e3d7 (diff)
parent5f41b705fc95b21c8edd6226bb50c0fa78a39261 (diff)
downloadlatinime-266ae6964d5bcab82e10f6ba7fe36f38da0c086d.tar.gz
latinime-266ae6964d5bcab82e10f6ba7fe36f38da0c086d.tar.xz
latinime-266ae6964d5bcab82e10f6ba7fe36f38da0c086d.zip
Merge "Fix a bug with the whitelist"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WhitelistDictionary.java')
-rw-r--r--java/src/com/android/inputmethod/latin/WhitelistDictionary.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/WhitelistDictionary.java b/java/src/com/android/inputmethod/latin/WhitelistDictionary.java
index 93474b654..96241a340 100644
--- a/java/src/com/android/inputmethod/latin/WhitelistDictionary.java
+++ b/java/src/com/android/inputmethod/latin/WhitelistDictionary.java
@@ -93,4 +93,20 @@ public class WhitelistDictionary extends Dictionary {
if (TextUtils.isEmpty(word)) return false;
return !TextUtils.isEmpty(getWhiteListedWord(word.toString()));
}
+
+ // See LatinIME#updateSuggestions. This breaks in the (queer) case that the whitelist
+ // lists that word a should autocorrect to word b, and word c would autocorrect to
+ // an upper-cased version of a. In this case, the way this return value is used would
+ // remove the first candidate when the user typed the upper-cased version of A.
+ // Example : abc -> def and xyz -> Abc
+ // A user typing Abc would experience it being autocorrected to something else (not
+ // necessarily def).
+ // There is no such combination in the whitelist at the time and there probably won't
+ // ever be - it doesn't make sense. But still.
+ public boolean shouldForciblyAutoCorrectFrom(CharSequence word) {
+ if (TextUtils.isEmpty(word)) return false;
+ final String correction = getWhiteListedWord(word.toString());
+ if (TextUtils.isEmpty(correction)) return false;
+ return !correction.equals(word);
+ }
}