-
-
Notifications
You must be signed in to change notification settings - Fork 40.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve consistency in UNICODEMAP code and docs, update docs/understanding_qmk #4774
Conversation
This is done for consistency: UNICODEMAP is the method (hence UNICODEMAP_ENABLE, process_unicodemap), whereas unicode_map is the mapping table itself.
781e2b5
to
8877605
Compare
This avoids the issue of the compiler sometimes complaining about the array index being out of range
8877605
to
ca04a30
Compare
@drashna I'd appreciate a review, fellow Unicodee 😄 |
#ifdef UNICODEMAP_ENABLE | ||
#define X(n) (QK_UNICODE_MAP | (n)) | ||
// Allows Unicode input up to 0x10FFFF, requires unicode_map | ||
#define X(i) (QK_UNICODEMAP | (i)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to add this myself, but I'd like to see an "else" for both of these (UC
and X
) that define them as empty functions, so they don't error out when compiling when the respective feature is disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They could be defined as KC_NONE
in that case. But what's the use case? It seems to me like you'd want compilation to fail as fast as possible if you put UC
or X
in your keymap but forget to enable the corresponding feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that failing is the best option here, to be honest.
Two reasons really come up for this:
- Community Layouts
- EEPROM storage of keymaps
Also, testing comes to mind, but that's an edge case.
The alternative is that if I want to do this locally, I would have to "ifdef" the keycodes ANYWAYS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But for now, I'll just merge this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate on the community layouts bit? I think I know what you mean, but it'd be best if you could clarify just in case.
As far as keymap storage goes, UC
and X
themselves aren't part of the keycodes enum (they're just macros), so leaving them undefined doesn't affect other keycodes. What does get left out is QK_UNICODE
and QK_UNICODEMAP
, but if I'm not mistaken, those should be left out for the sake of feature flagging.
Thanks! |
* 'master' of https://github.com/qmk/qmk_firmware: (63 commits) Keymap: ave-63's iris layout (qmk#4812) Update bakingpy 4x12 keymap and add test mode for debugging/development (qmk#4810) Fix Mac mute keycode (qmk#4809) Add KBD75 keymap (qmk#4808) Fix pinout of split hand and LED, remove flip half option Tidy up Mod-Tap shortcuts (qmk#4806) Add missing parentheses to some important macros (qmk#4775) Keyboard: Downbubble refactor and Configurator fix (qmk#4798) Alternate keymap for Alpha keyboard, enjoy! (qmk#4797) Keymap: Added Model F-inspired layout for YMD[K]96 (qmk#4777) Improve consistency in UNICODEMAP code and docs, update docs/understanding_qmk (qmk#4774) Update to arm_atsam wait and timer routines Add Downbubble to Handwired repository (qmk#4794) Final HS60v2 changes. (qmk#4790) Keyboard: Fractal layout macro and readme cleanup (qmk#4789) Keymap: added my espectro keymap (qmk#4791) Keyboard: Numbrero: Configurator fix and code tidy (qmk#4787) Keyboard: Tradestation code tidy and readme refactor (qmk#4784) Keyboard: update readme with ps2avr flashing instructions (qmk#4776) add Pinky keyboard (qmk#4748) ...
…nding_qmk (qmk#4774) * Remove unused UNICODE(n) macro, update docs * Add note about max length of unicode_map to docs * QK_UNICODE_MAP → QK_UNICODEMAP * Refactor process_unicode_map * process_unicode_map → process_unicodemap This is done for consistency: UNICODEMAP is the method (hence UNICODEMAP_ENABLE, process_unicodemap), whereas unicode_map is the mapping table itself. * Update references and ordering in docs/understanding_qmk * Add additional note to docs/understanding_qmk * &unicode_map[index] → unicode_map + index This avoids the issue of the compiler sometimes complaining about the array index being out of range * Update docs/getting_started_make_guide * Update method sections in docs/feature_unicode
…nding_qmk (qmk#4774) * Remove unused UNICODE(n) macro, update docs * Add note about max length of unicode_map to docs * QK_UNICODE_MAP → QK_UNICODEMAP * Refactor process_unicode_map * process_unicode_map → process_unicodemap This is done for consistency: UNICODEMAP is the method (hence UNICODEMAP_ENABLE, process_unicodemap), whereas unicode_map is the mapping table itself. * Update references and ordering in docs/understanding_qmk * Add additional note to docs/understanding_qmk * &unicode_map[index] → unicode_map + index This avoids the issue of the compiler sometimes complaining about the array index being out of range * Update docs/getting_started_make_guide * Update method sections in docs/feature_unicode
…nding_qmk (qmk#4774) * Remove unused UNICODE(n) macro, update docs * Add note about max length of unicode_map to docs * QK_UNICODE_MAP → QK_UNICODEMAP * Refactor process_unicode_map * process_unicode_map → process_unicodemap This is done for consistency: UNICODEMAP is the method (hence UNICODEMAP_ENABLE, process_unicodemap), whereas unicode_map is the mapping table itself. * Update references and ordering in docs/understanding_qmk * Add additional note to docs/understanding_qmk * &unicode_map[index] → unicode_map + index This avoids the issue of the compiler sometimes complaining about the array index being out of range * Update docs/getting_started_make_guide * Update method sections in docs/feature_unicode
Rename some constants and functions pertaining to UNICODEMAP so they're consistent with the rest of the system. Also update the documentation accordingly. See below for details.
These changes should be non-breaking. I've taken care to update all usages of the renamed symbols.
Description
Remove unused
UNICODE(n)
macro (alias forUC(n)
, but no one was using it).Rename
QK_UNICODE_MAP
constant toQK_UNICODEMAP
(only used internally).Rename
unicode_map_input_error
function tounicodemap_input_error
(only used internally).Rename
process_unicode_map
function toprocess_unicodemap
(only used internally).Reasoning:
UNICODEMAP
is the name of the keymap definition method (henceUNICODEMAP_ENABLE
,process_unicodemap
etc.), whereasunicode_map
refers to the mapping table itself, which is used by the method.Refactor
process_unicodemap
code a bit to make it more readable.Update links in docs/understanding_qmk and rearrange the list of process record functions so it matches the actual order in which they're called now (the order was slightly altered in Overhaul Unicode Common functionality #4325).
Various Unicode doc improvements.
Tested by compiling several keymaps that use UNICODEMAP.
P.S. When I say it's only used internally, I mean it's only used by QMK's internals and not directly in any userspaces/keymaps. That's why I think it's okay to rename these symbols. No “user facing” symbols were altered in the making of this PR 😛
Types of changes
Checklist: