summaryrefslogtreecommitdiffstats
path: root/input/input.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-19 14:21:57 +0200
committerwm4 <wm4@nowhere>2014-04-19 14:27:26 +0200
commitd9106779375288323b5c63bc2bab341515f8a60d (patch)
tree4981241df05b4000ae167605a843f65e3e41ca38 /input/input.c
parentec18d2468379f496adcabc7a1678bd3e0b823a1e (diff)
downloadmpv-d9106779375288323b5c63bc2bab341515f8a60d.tar.bz2
mpv-d9106779375288323b5c63bc2bab341515f8a60d.tar.xz
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.
Diffstat (limited to 'input/input.c')
-rw-r--r--input/input.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/input/input.c b/input/input.c
index c17d4d3c94..5e25dd9c38 100644
--- a/input/input.c
+++ b/input/input.c
@@ -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)