From 3f86d6d46014ca55e42cecd570d7f269b1d386b3 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 13 Apr 2020 15:55:51 +0000 Subject: When adding a list of commands to the queue, instead of automatically creating a new state for each group of commands, require the caller to create one and use it for all the commands in the list. This means the current target works even with list with multiple groups (which can happen if they are defined with newlines). --- menu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index c72be5ce..b76869bc 100644 --- a/menu.c +++ b/menu.c @@ -185,6 +185,7 @@ menu_key_cb(struct client *c, struct key_event *event) int count = menu->count, old = md->choice; const struct menu_item *item; struct cmdq_item *new_item; + struct cmdq_state *new_state; struct cmd_parse_result *pr; const char *name; @@ -285,7 +286,9 @@ chosen: event = cmdq_get_event(md->item); else event = NULL; - new_item = cmdq_get_command(pr->cmdlist, &md->fs, event, 0); + new_state = cmdq_new_state(&md->fs, event, 0); + new_item = cmdq_get_command(pr->cmdlist, new_state); + cmdq_free_state(new_state); cmd_list_free(pr->cmdlist); cmdq_append(c, new_item); break; -- cgit v1.2.3