Skip to content

Allow larger autocorrect dictionaries via configurable link size#25838

Closed
MustafaNisar2002 wants to merge 5 commits intoqmk:developfrom
MustafaNisar2002:feature/autocorrect-large-dicts
Closed

Allow larger autocorrect dictionaries via configurable link size#25838
MustafaNisar2002 wants to merge 5 commits intoqmk:developfrom
MustafaNisar2002:feature/autocorrect-large-dicts

Conversation

@MustafaNisar2002
Copy link

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

  • Core
  • Enhancement/optimization
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • 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).
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

# error "AUTOCORRECT_LINK_BYTE_COUNT must be either 2 or 3 bytes."
#endif

#if defined(__AVR__) && DICTIONARY_SIZE > UINT16_MAX
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would not accept platform specific logic in core, when there is an abstraction in place that already exists.

platforms/progmem.h would need to be updated to add pgm_read_byte_far compatibility.

Suggested change
#if defined(__AVR__) && DICTIONARY_SIZE > UINT16_MAX
#if DICTIONARY_SIZE > UINT16_MAX

@zvecr
Copy link
Member

zvecr commented Dec 7, 2025

You also have both c and py code that needs to pass formatting checks.

@drashna drashna self-requested a review December 7, 2025 21:33
@github-actions
Copy link

Thank you for your contribution!
This pull request has been automatically marked as stale because it has not had activity in the last 45 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, or re-open when it's ready.
For maintainers: Please label with bug, awaiting review, breaking_change, in progress, or on hold to prevent the issue from being re-flagged.

@github-actions github-actions bot added the stale Issues or pull requests that have become inactive without resolution. label Jan 22, 2026
@drashna drashna mentioned this pull request Feb 10, 2026
11 tasks
@github-actions
Copy link

Thank you for your contribution!
This pull request has been automatically closed because it has not had activity in the last 30 days. Please feel free to give a status update now, ping for review, or re-open when it's ready.
// [stale-action-closed]

@github-actions github-actions bot closed this Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli qmk cli command core documentation python stale Issues or pull requests that have become inactive without resolution.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Increase autocorrect dictionary size limit

3 participants