diff options
author | 2013-10-07 10:04:18 +0000 | |
---|---|---|
committer | 2013-10-07 10:04:18 +0000 | |
commit | 86f7711407b65c341b38a9fb297c3e5f0532da26 (patch) | |
tree | 546eaa42e124dea7e6b0a98a1ce41b9a4ff874c4 | |
parent | a6047aae941e0723367fa9c52157271eb405b6fb (diff) | |
parent | f309f2288b0652df0b611ed3f86897c939e68d63 (diff) | |
download | latinime-86f7711407b65c341b38a9fb297c3e5f0532da26.tar.gz latinime-86f7711407b65c341b38a9fb297c3e5f0532da26.tar.xz latinime-86f7711407b65c341b38a9fb297c3e5f0532da26.zip |
Merge "Don't auto-correct to non-whitelist shortcuts"
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 6 | ||||
-rw-r--r-- | native/jni/src/suggest/core/dictionary/shortcut_utils.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 9fd1f53a2..c270d47d0 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -286,14 +286,16 @@ public final class Suggest { // the word *would* have been auto-corrected. if (!isCorrectionEnabled || !allowsToBeAutoCorrected || !wordComposer.isComposingWord() || suggestionsSet.isEmpty() || wordComposer.hasDigits() - || wordComposer.isMostlyCaps() || wordComposer.isResumed() - || !hasMainDictionary()) { + || wordComposer.isMostlyCaps() || wordComposer.isResumed() || !hasMainDictionary() + || SuggestedWordInfo.KIND_SHORTCUT == suggestionsSet.first().mKind) { // If we don't have a main dictionary, we never want to auto-correct. The reason for // this is, the user may have a contact whose name happens to match a valid word in // their language, and it will unexpectedly auto-correct. For example, if the user // types in English with no dictionary and has a "Will" in their contact list, "will" // would always auto-correct to "Will" which is unwanted. Hence, no main dict => no // auto-correct. + // Also, shortcuts should never auto-correct unless they are whitelist entries. + // TODO: we may want to have shortcut-only entries auto-correct in the future. hasAutoCorrection = false; } else { hasAutoCorrection = AutoCorrectionUtils.suggestionExceedsAutoCorrectionThreshold( diff --git a/native/jni/src/suggest/core/dictionary/shortcut_utils.h b/native/jni/src/suggest/core/dictionary/shortcut_utils.h index 461d7b454..9ccef020f 100644 --- a/native/jni/src/suggest/core/dictionary/shortcut_utils.h +++ b/native/jni/src/suggest/core/dictionary/shortcut_utils.h @@ -44,7 +44,7 @@ class ShortcutUtils { shortcutScore = finalScore; // Protection against int underflow shortcutScore = max(S_INT_MIN + 1, shortcutScore) - 1; - kind = Dictionary::KIND_CORRECTION; + kind = Dictionary::KIND_SHORTCUT; } outputTypes[outputWordIndex] = kind; frequencies[outputWordIndex] = shortcutScore; |