Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parentheses around kemaps are stripped too eagerly #91

Open
hupfdule opened this issue Apr 28, 2023 · 0 comments · May be fixed by #92
Open

Parentheses around kemaps are stripped too eagerly #91

hupfdule opened this issue Apr 28, 2023 · 0 comments · May be fixed by #92

Comments

@hupfdule
Copy link

The code seems to remove surrounding parentheses before splitting a keymap into chunks. However it seems that if the last key in a keymap ends with a parentheses this one will be stripped as well and therefore the key is parsed incorrectly.

See for example the Model01 keymap from QMK. The last two keys (the palm keys) are both defined as MO(FUN). But when running keymapviz over (via PR #90) it the last one is incorrectly parsed as MO.

/* ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┐                           ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┐
 * │QK_BOO│  1   │  2   │  3   │  4   │  5   │RGB_MO│                           │      │  6   │  7   │  8   │  9   │  0   │TG(NUM│
 * ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤                           ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤
 * │ GRV  │  Q   │  W   │  E   │  R   │  T   │      │                           │      │  Y   │  U   │  I   │  O   │  P   │ EQL  │
 * ├──────┼──────┼──────┼──────┼──────┼──────┤ TAB  │                           │ ENT  ├──────┼──────┼──────┼──────┼──────┼──────┤
 * │ PGUP │  A   │  S   │  D   │  F   │  G   ├──────┤                           ├──────┤  H   │  J   │  K   │  L   │ SCLN │ QUOT │
 * ├──────┼──────┼──────┼──────┼──────┼──────┤      │                           │      ├──────┼──────┼──────┼──────┼──────┼──────┤
 * │ PGDN │  Z   │  X   │  C   │  V   │  B   │ ESC  │                           │      │  N   │  M   │ COMM │ DOT  │ SLSH │ MINS │
 * └──────┴──────┴──────┴──────┴──────┴──────┴──────┘                           └──────┴──────┴──────┴──────┴──────┴──────┴──────┘
 *
 *                             ┌──────┬──────┐                                         ┌──────┬──────┐
 *                             │ LCTL │ BSPC ├──────┐                           ┌──────┤ SPC  │ RCTL │
 *                             │      │      │ LGUI ├──────┐             ┌──────┤ RALT │      │      │
 *                             └──────┴──────┤      │ LSFT │             │ RSFT │      ├──────┴──────┘
 *                                           └──────┤      │             │      ├──────┘
 *                                 ┌──────┐         └──────┘             └──────┘           ┌──────┐
 *                                 │      │                                                 │      │
 *                                 │MO(FUN│                                                 │  MO  │
 *                                 │      │                                                 │      │
 *                                 └──────┘                                                 └──────┘
 *                                                                                                      generated by [keymapviz] */

This is not specific to PR #90. It happens with already existing code, too.

hupfdule added a commit to hupfdule/keymapviz that referenced this issue Jun 30, 2023
The current code strips _all_ surrounding parentheses, while only the
outermost should be stripped. This commit changes this.

Closes yskoht#91
@hupfdule hupfdule linked a pull request Jun 30, 2023 that will close this issue
hupfdule added a commit to hupfdule/keymapviz that referenced this issue Jul 1, 2023
The current code strips _all_ surrounding parentheses, while only the
outermost should be stripped. This commit changes this.

Closes yskoht#91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant