diff --git a/core/input/input.c b/core/input/input.c index 73ac5bc698..ce7b868c02 100644 --- a/core/input/input.c +++ b/core/input/input.c @@ -1034,6 +1034,7 @@ mp_cmd_t *mp_input_parse_cmd(bstr str, const char *loc) *list = (struct mp_cmd) { .id = MP_CMD_COMMAND_LIST, .name = "list", + .original = bstrdup(list, str), }; list->args[0].v.p = cmd; while (cmd) { @@ -1775,6 +1776,17 @@ mp_cmd_t *mp_cmd_clone(mp_cmd_t *cmd) ret->args[i].v.s = talloc_strdup(ret, cmd->args[i].v.s); } + if (cmd->id == MP_CMD_COMMAND_LIST) { + bool first = true; + for (struct mp_cmd *sub = cmd->args[0].v.p; sub; sub = sub->queue_next) { + sub = mp_cmd_clone(sub); + talloc_steal(cmd, sub); + if (first) + cmd->args[0].v.p = sub; + first = false; + } + } + return ret; }