mirror of https://github.com/mpv-player/mpv
input: discard key history when a key is mapped
This is for the sake of multi-key combinations (see github issue #718). Now a multi-key sequence isn't matched if any of the previous keys were actually mapped.
This commit is contained in:
parent
ec18d24683
commit
d910677937
|
@ -58,10 +58,10 @@ It's also possible to bind a command to a sequence of keys:
|
|||
|
||||
(This is not shown in the general command syntax.)
|
||||
|
||||
If ``a`` or ``a-b`` or ``b`` are already bound, this will run all commands. It
|
||||
doesn't delay key bindings, and it simply considers the past key history on
|
||||
any key press. Intermediate keys can be mapped to ``ignore`` in order to avoid
|
||||
this issue.
|
||||
If ``a`` or ``a-b`` or ``b`` are already bound, this will run the first command
|
||||
that matches, and the multi-key command will never be called. Intermediate keys
|
||||
can be remapped to ``ignore`` in order to avoid this issue. The maximum number
|
||||
of (non-modifier) keys for combinations is currently 4.
|
||||
|
||||
List of Input Commands
|
||||
----------------------
|
||||
|
|
|
@ -559,12 +559,16 @@ static struct mp_cmd *resolve_key(struct input_ctx *ictx, int code)
|
|||
{
|
||||
update_mouse_section(ictx);
|
||||
struct mp_cmd *cmd = get_cmd_from_keys(ictx, NULL, code);
|
||||
key_buf_add(ictx->key_history, code);
|
||||
if (cmd && should_drop_cmd(ictx, cmd)) {
|
||||
if (cmd && cmd->id != MP_CMD_IGNORE) {
|
||||
memset(ictx->key_history, 0, sizeof(ictx->key_history));
|
||||
if (!should_drop_cmd(ictx, cmd))
|
||||
return cmd;
|
||||
talloc_free(cmd);
|
||||
return NULL;
|
||||
}
|
||||
return cmd;
|
||||
talloc_free(cmd);
|
||||
key_buf_add(ictx->key_history, code);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void interpret_key(struct input_ctx *ictx, int code, double scale)
|
||||
|
|
Loading…
Reference in New Issue