summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/menu.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-04-13 15:55:52 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-04-13 15:55:52 +0000
commitbbcd02d308c01313ff44ba41376758f81178d8ab (patch)
treec6cbb71bd44cf5c395891b8b7ae04c6fc330e498 /usr.bin/tmux/menu.c
parent209c1b999f121d23cb4604659577998e9c854d0c (diff)
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).
Diffstat (limited to 'usr.bin/tmux/menu.c')
-rw-r--r--usr.bin/tmux/menu.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/tmux/menu.c b/usr.bin/tmux/menu.c
index 53a48b4e8b4..1783a950669 100644
--- a/usr.bin/tmux/menu.c
+++ b/usr.bin/tmux/menu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: menu.c,v 1.19 2020/04/13 14:46:04 nicm Exp $ */
+/* $OpenBSD: menu.c,v 1.20 2020/04/13 15:55:51 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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;