Tidy up use of keycode range helpers (#19756)
This commit is contained in:
parent
2ffdec5dc2
commit
1d0b4c8d38
16 changed files with 39 additions and 33 deletions
|
@ -8,6 +8,14 @@ from qmk.path import normpath
|
|||
from qmk.keycodes import load_spec
|
||||
|
||||
|
||||
def _translate_group(group):
|
||||
"""Fix up any issues with badly chosen values
|
||||
"""
|
||||
if group == 'modifiers':
|
||||
return 'modifier'
|
||||
return group
|
||||
|
||||
|
||||
def _render_key(key):
|
||||
width = 7
|
||||
if 'S(' in key:
|
||||
|
@ -82,7 +90,7 @@ def _generate_helpers(lines, keycodes):
|
|||
for group, codes in temp.items():
|
||||
lo = keycodes["keycodes"][f'0x{codes[0]:04X}']['key']
|
||||
hi = keycodes["keycodes"][f'0x{codes[1]:04X}']['key']
|
||||
lines.append(f'#define IS_{ group.upper() }_KEYCODE(code) ((code) >= {lo} && (code) <= {hi})')
|
||||
lines.append(f'#define IS_{ _translate_group(group).upper() }_KEYCODE(code) ((code) >= {lo} && (code) <= {hi})')
|
||||
|
||||
|
||||
def _generate_aliases(lines, keycodes):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue