Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0675d374 authored by Jean Chalard's avatar Jean Chalard Committed by Android Git Automerger
Browse files

am 86f77114: Merge "Don\'t auto-correct to non-whitelist shortcuts"

* commit '86f77114':
  Don't auto-correct to non-whitelist shortcuts
parents d44b2490 86f77114
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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(
+1 −1
Original line number Diff line number Diff line
@@ -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;