mirror of https://github.com/mpv-player/mpv
input: fix builtin sequence bindings
If g-p is a builtin binding and p is bound in input.conf, pressing g-p triggers the p binding. Fix this by searching for builtin bindings that match a longer key sequence even after a user-defined binding has been found. Even after changing the condition from >= to > bindings of the same key defined later in input.conf are still preferred over earlier ones, because bind_keys() overwrites duplicate bindings. Bindings defined by later mp.add_key_binding calls are also still preferred.
This commit is contained in:
parent
e6af31dc0c
commit
994a08f5a7
|
@ -407,8 +407,6 @@ static struct cmd_bind *find_bind_for_key_section(struct input_ctx *ictx,
|
|||
for (int builtin = 0; builtin < 2; builtin++) {
|
||||
if (builtin && !ictx->opts->default_bindings)
|
||||
break;
|
||||
if (best)
|
||||
break;
|
||||
for (int n = 0; n < bs->num_binds; n++) {
|
||||
if (bs->binds[n].is_builtin == (bool)builtin) {
|
||||
struct cmd_bind *b = &bs->binds[n];
|
||||
|
@ -418,7 +416,7 @@ static struct cmd_bind *find_bind_for_key_section(struct input_ctx *ictx,
|
|||
if (b->keys[i] != keys[b->num_keys - 1 - i])
|
||||
goto skip;
|
||||
}
|
||||
if (!best || b->num_keys >= best->num_keys)
|
||||
if (!best || b->num_keys > best->num_keys)
|
||||
best = b;
|
||||
skip: ;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue