config: parse 'none' as empty modifiers value

This commit is contained in:
feeptr@codeberg.org 2021-11-29 21:45:00 +00:00
parent 300acda813
commit 46cadee80f

View file

@ -1485,6 +1485,11 @@ parse_modifiers(struct context *ctx, const char *text, size_t len,
bool ret = false; bool ret = false;
*modifiers = (struct config_key_modifiers){0}; *modifiers = (struct config_key_modifiers){0};
/* Handle "none" separately because e.g. none+shift is nonsense */
if (strncmp(text, "none", len) == 0)
return true;
char *copy = xstrndup(text, len); char *copy = xstrndup(text, len);
for (char *tok_ctx = NULL, *key = strtok_r(copy, "+", &tok_ctx); for (char *tok_ctx = NULL, *key = strtok_r(copy, "+", &tok_ctx);