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 Jul 1, 2023
1 parent effdf71 commit 22b235d
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 @@ -84,7 +84,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 22b235d

Please sign in to comment.