From f1205293a70b13f53bfce0a1a9859132b8421443 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 10 Sep 2015 14:15:12 +0200 Subject: command: make "add 0" not change the value The value 0 was treated specially, and effectively forced the increment to 1. Interestingly, passing 0 or no value also does not include the scale (from touchpads etc.), but this is probably an accidental behavior that was never intentionally added. Simplify it and make the default increment 1. 0 now means what it should: the value will not be changed. This is not particularly useful, but on the other hand there is no need for surprising and unintuitive semantics. OARG_CYCLEDIR() failed to apply the default value, because m_option_type_cycle_dir was missing a copy handler - add this too. --- player/command.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index 8514be98f7..19f725ba3a 100644 --- a/player/command.c +++ b/player/command.c @@ -4286,13 +4286,11 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re case MP_CMD_ADD: case MP_CMD_CYCLE: { + char *property = cmd->args[0].v.s; struct m_property_switch_arg s = { - .inc = 1, + .inc = cmd->args[1].v.d * cmd->scale, .wrap = cmd->id == MP_CMD_CYCLE, }; - if (cmd->args[1].v.d) - s.inc = cmd->args[1].v.d * cmd->scale; - char *property = cmd->args[0].v.s; if (cmd->repeated && !check_property_autorepeat(property, mpctx)) { MP_VERBOSE(mpctx, "Dropping command '%.*s' from auto-repeated key.\n", BSTR_P(cmd->original)); -- cgit v1.2.3