Skip to content

feat(autocorrect): apply exact personal dictionary shortcuts to valid typed words - #924

Merged
LeanBitLab merged 1 commit into
mainfrom
feat/exact-shortcut-autocorrect
Nov 25, 2026
Merged

LeanBitLab merged 1 commit into
mainfrom
feat/exact-shortcut-autocorrect

Conversation

@LeanBitLab

Copy link
Copy Markdown
Owner

Changes

Users with frequent typos that are real words ("fir" for "for", "nit" for "not", reported on r/LeanBitLab_) could not fix them through the personal dictionary: a shortcut entry was only suggested, never auto-corrected, because the typed word is valid. The native dictionary also emitted shortcuts for fuzzy matches without marking which one was typed exactly.

  • Native (suggestions_output_utils.cpp): shortcut output gets KIND_FLAG_EXACT_MATCH when its key equals the typed word (sameAsTyped). No other code reads this flag for shortcuts.
  • Suggest.kt: with Auto-correct shortcuts on, an exact shortcut is promoted to the first suggestion and auto-corrected, even for valid or short typed words. Recently reverted corrections are still respected; fuzzy shortcut matches ("fit" near key "fir") keep the old behaviour.

Usage: personal dictionary entry word for, shortcut fir, plus Text correction > Auto-correct shortcuts.

Verification

  • ./gradlew :app:testStandardDebugUnitTest --tests "helium314.keyboard.latin.SuggestTest": 29/29 pass (3 new tests: exact vs fuzzy shortcut, setting off, promotion).
  • Debug APK (with native rebuild) built and installed on a device for manual testing.

… typed words

A shortcut like "fir" -> "for" was only suggested, never auto-corrected, because "fir" is a valid word and the native dictionary did not mark whether the shortcut key was typed exactly. Flag exact shortcut matches in native output; with Auto-correct shortcuts on, promote such a shortcut to the first suggestion and auto-correct to it, still respecting recently reverted corrections. Fuzzy shortcut matches keep the old behaviour.
@LeanBitLab
LeanBitLab merged commit 507f48d into main Nov 25, 2026
1 check passed
@LeanBitLab
LeanBitLab deleted the feat/exact-shortcut-autocorrect branch November 25, 2026 12:42
LeanBitLab added a commit that referenced this pull request Nov 26, 2026
The exact-shortcut rule from #924 did not check the source dictionary.
Shortcuts of other dictionaries, such as the emoji dictionary, were moved
to the first position and auto-corrected, even over a valid typed word.

Claude-Session: https://claude.ai/code/session_017YwBxUnnx3DqiiATw5XxUk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant