Skip to content

Commit

Permalink
Fix stripping of enclosing parentheses
Browse files Browse the repository at this point in the history
The current code strips _all_ surrounding parentheses, while only the
outermost should be stripped. This commit changes this.

Closes yskoht#91
  • Loading branch information
hupfdule committed Jun 30, 2023
1 parent 2423b69 commit 6c0cb0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion keymapviz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __parse_keymap_c(self):
r'\s*(\w+(?<rec>\((?:[^()]|(?&rec))*\))*)\s*,?'
)
keymaps = keymap_regexp.findall(src)
keymaps = [_.lstrip('(').rstrip(')') for _ in keymaps]
keymaps = [re.sub(r"^\(?(.*)\)?$", r"\1", _) for _ in keymaps]
keymaps = [[__[0] for __ in keycode_regexp.findall(_)] for _ in keymaps]
return keymaps

Expand Down

0 comments on commit 6c0cb0d

Please sign in to comment.