Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/src/main/java/helium314/keyboard/latin/Suggest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ class Suggest(private val mDictionaryFacilitator: DictionaryFacilitator) {
|| (wordComposer.isMostlyCaps() && !wordComposer.isAllUpperCase()) // We never auto-correct when suggestions are resumed because it would be unexpected
|| wordComposer.isResumed() // If we don't have a main dictionary, we never want to auto-correct. The reason
|| isDeveloperTokenOrSpecialSyntax(consideredWord)
// never replace a typed word with an emoji, unless the user mapped it as a shortcut. The emoji dictionary
// is part of the main dictionary, so without a word list emojis can be the only candidates
|| (firstSuggestionInContainer?.isEmoji == true && !isExactShortcut(firstSuggestionInContainer))
// 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
Expand Down
14 changes: 14 additions & 0 deletions app/src/test/java/helium314/keyboard/latin/SuggestTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ class SuggestTest {
.edit { putBoolean(Settings.PREF_AUTO_CORRECTION, true) } // need to enable, off by default
}

// with only an emoji dictionary (no word list), emojis are the only candidates for any unknown word
@Test fun `unknown word is not autocorrected to an emoji`() {
val locale = Locale.ENGLISH
val result = shouldBeAutoCorrected(
"lov",
listOf(suggestion("\uD83D\uDE0D", Int.MAX_VALUE, locale)),
null,
null,
locale,
thresholdVeryAggressive
)
assert(!result.last()) // should not be corrected
}

@Test fun `'on' to 'in' if 'in' was used before in this context`() {
val locale = Locale.ENGLISH
val result = shouldBeAutoCorrected(
Expand Down
Loading