WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Increase autocorrect dictionary size limit

3 participants