summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2021-08-17 00:11:17 +0300
committeravih <avih@users.noreply.github.com>2021-08-17 22:45:39 +0300
commit3abb23d70f064803e0399f44714791687b455b2f (patch)
treebbb6ce8706779921eb787f83ebff2fc9fc202423 /input
parent4c7d7a80016d3f5cde903043ed880cae386b80d3 (diff)
downloadmpv-3abb23d70f064803e0399f44714791687b455b2f.tar.bz2
mpv-3abb23d70f064803e0399f44714791687b455b2f.tar.xz
command: don't hardcode commands list to be repeatable
Previously, a list of commands was always considered repeatable. This behavior was added at 6710527a (and moved around since then), in order to fix #807 (impossible to make a repeatable list). The problem was that a list doesn't have the normal repeatability flags and so it was never repeatable, so it was hardcoded to be repeatable instead. Presumably it was deemed good enough. However, this made it impossible to have a non-repeatable list. This commit changes the behavior so that a list repeatability is that of the first command at the list. This way, any list can be made either repeatable or non-repeatable using the following idiom (e.g. at input.conf), based on the fact that the "ignore" command is not repeatable by default: x ignore; cmd1...; cmd2... # non-repeatable y repeatable ignore; cmd1...; cmd2... # repeatable Fixes #7841
Diffstat (limited to 'input')
-rw-r--r--input/cmd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/input/cmd.c b/input/cmd.c
index 0ab06e3574..64232143f7 100644
--- a/input/cmd.c
+++ b/input/cmd.c
@@ -608,8 +608,10 @@ void mp_cmd_dump(struct mp_log *log, int msgl, char *header, struct mp_cmd *cmd)
bool mp_input_is_repeatable_cmd(struct mp_cmd *cmd)
{
- return (cmd->def->allow_auto_repeat) || cmd->def == &mp_cmd_list ||
- (cmd->flags & MP_ALLOW_REPEAT);
+ if (cmd->def == &mp_cmd_list && cmd->args[0].v.p)
+ cmd = cmd->args[0].v.p; // list - only 1st cmd is considered
+
+ return (cmd->def->allow_auto_repeat) || (cmd->flags & MP_ALLOW_REPEAT);
}
bool mp_input_is_scalable_cmd(struct mp_cmd *cmd)