From d9106779375288323b5c63bc2bab341515f8a60d Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 19 Apr 2014 14:21:57 +0200 Subject: 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. --- input/input.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'input') 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) -- cgit v1.2.3