mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
command: fix keybind command with sequence keys
The command is documented to use the same syntax as input.conf, but it doesn't work with sequence keys because it uses mp_input_get_key_from_name for checking key names, when it should use mp_input_get_keys_from_string instead. Fix this by using the correct function.
This commit is contained in:
@@ -6626,17 +6626,15 @@ static void cmd_key_bind(void *p)
|
||||
struct mp_cmd_ctx *cmd = p;
|
||||
struct MPContext *mpctx = cmd->mpctx;
|
||||
|
||||
int code = mp_input_get_key_from_name(cmd->args[0].v.s);
|
||||
if (code < 0) {
|
||||
MP_ERR(mpctx, "%s is not a valid input name.\n", cmd->args[0].v.s);
|
||||
cmd->success = false;
|
||||
return;
|
||||
}
|
||||
const char *key = cmd->args[0].v.s;
|
||||
const char *target_cmd = cmd->args[1].v.s;
|
||||
const char *comment = cmd->args[2].v.s;
|
||||
if (comment && !*comment)
|
||||
comment = NULL;
|
||||
mp_input_bind_key(mpctx->input, code, bstr0(target_cmd), comment);
|
||||
if (!mp_input_bind_key(mpctx->input, key, bstr0(target_cmd), comment)) {
|
||||
MP_ERR(mpctx, "%s is not a valid input name.\n", key);
|
||||
cmd->success = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void cmd_apply_profile(void *p)
|
||||
|
||||
Reference in New Issue
Block a user