summaryrefslogtreecommitdiffstats
path: root/lib/python/qmk
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2023-02-10 21:10:14 +0000
committerGitHub <noreply@github.com>2023-02-10 21:10:14 +0000
commit1d0b4c8d38794dc019ecb224f2992b4ddfa70839 (patch)
tree48e0423bcafbb2fa680c7bc5199aba8794665339 /lib/python/qmk
parent2ffdec5dc2a5cb350998168e76d7916e2d9728fc (diff)
Tidy up use of keycode range helpers (#19756)
Diffstat (limited to 'lib/python/qmk')
-rw-r--r--lib/python/qmk/cli/generate/keycodes.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/python/qmk/cli/generate/keycodes.py b/lib/python/qmk/cli/generate/keycodes.py
index 2ed84cd589..f5c646e0ea 100644
--- a/lib/python/qmk/cli/generate/keycodes.py
+++ b/lib/python/qmk/cli/generate/keycodes.py
@@ -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):