Skip to content

Commit

Permalink
fix: Make QMK parsing more robust to spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
caksoylar committed Jun 30, 2024
1 parent c4317b6 commit 7f17329
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions keymap_drawer/parse/qmk.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class QmkJsonParser(KeymapParser):
_mo_re = re.compile(r"MO\((\d+)\)")
_tog_re = re.compile(r"(TG|TO|DF)\((\d+)\)")
_mts_re = re.compile(r"([A-Z_]+)_T\((\S+)\)")
_mtl_re = re.compile(r"MT\((\S+), *(\S+)\)")
_lt_re = re.compile(r"LT\((\d+), *(\S+)\)")
_mtl_re = re.compile(r"MT\((\S+),(\S+)\)")
_lt_re = re.compile(r"LT\((\d+),(\S+)\)")
_osm_re = re.compile(r"OSM\(MOD_(\S+)\)")
_osl_re = re.compile(r"OSL\((\d+)\)")
_tt_re = re.compile(r"TT\((\d+)\)")
Expand Down Expand Up @@ -92,6 +92,7 @@ def mapped(key: str) -> LayoutKey:
mapped.apply_formatter(lambda key: self.format_modified_keys(key, mods))
return mapped

key_str = key_str.replace(" ", "")
if m := self._trans_re.fullmatch(key_str): # transparent
return self.trans_key
if m := self._mo_re.fullmatch(key_str): # momentary layer
Expand Down

0 comments on commit 7f17329

Please sign in to comment.