qmk_firmware icon indicating copy to clipboard operation
qmk_firmware copied to clipboard

Allow larger autocorrect dictionaries via configurable link size

Open MustafaNisar2002 opened this issue 1 month ago • 0 comments

Description

This PR relaxes the size limit on autocorrect dictionaries so tables larger than 64KB can be generated and used safely.

  • Allow the autocorrect runtime to read tries with either 2- or 3-byte node links, using AUTOCORRECT_LINK_BYTE_COUNT defined in the generated header.
  • Update the autocorrect data generator to compute entry sizes, try 2-byte links first, and automatically switch to 3-byte links when the serialized table would exceed 64KB.
  • Emit AUTOCORRECT_LINK_BYTE_COUNT in generated autocorrect_data.h files and annotate the default autocorrect dictionary with its link size.
  • Document the new link format behaviour in docs/features/autocorrect.md.

Types of Changes

  • [x] Core
  • [x] Enhancement/optimization
  • [x] Documentation

Issues Fixed or Closed by This PR

  • Fixes qmk/qmk_firmware#25823

Checklist

  • [x] My code follows the code style of this project: C, Python
  • [x] I have read the PR Checklist document and have made the appropriate changes.
  • [x] My change requires a change to the documentation.
  • [x] I have updated the documentation accordingly.
  • [x] I have added tests or basic checks to cover my changes (e.g. python -m compileall lib/python/qmk/cli/generate/autocorrect_data.py and firmware builds with a generated dictionary).
  • [x] I have tested the changes and verified that they work and don't break anything (as well as I can manage).

MustafaNisar2002 avatar Nov 28 '25 19:11 MustafaNisar2002