=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-queue.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- src/usr.bin/tmux/cmd-queue.c 2019/05/25 10:46:55 1.71 +++ src/usr.bin/tmux/cmd-queue.c 2019/05/29 19:34:42 1.72 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-queue.c,v 1.71 2019/05/25 10:46:55 nicm Exp $ */ +/* $OpenBSD: cmd-queue.c,v 1.72 2019/05/29 19:34:42 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott @@ -203,16 +203,20 @@ struct cmdq_item *item, *first = NULL, *last = NULL; struct cmd *cmd; struct cmdq_shared *shared; + u_int group = 0; - shared = xcalloc(1, sizeof *shared); - if (current != NULL) - cmd_find_copy_state(&shared->current, current); - else - cmd_find_clear_state(&shared->current, 0); - if (m != NULL) - memcpy(&shared->mouse, m, sizeof shared->mouse); - TAILQ_FOREACH(cmd, &cmdlist->list, qentry) { + if (cmd->group != group) { + shared = xcalloc(1, sizeof *shared); + if (current != NULL) + cmd_find_copy_state(&shared->current, current); + else + cmd_find_clear_state(&shared->current, 0); + if (m != NULL) + memcpy(&shared->mouse, m, sizeof shared->mouse); + group = cmd->group; + } + item = xcalloc(1, sizeof *item); xasprintf(&item->name, "[%s/%p]", cmd->entry->name, item); item->type = CMDQ_COMMAND; @@ -263,12 +267,20 @@ cmdq_fire_command(struct cmdq_item *item) { struct client *c = item->client; + const char *name = cmdq_name(c); struct cmdq_shared *shared = item->shared; struct cmd *cmd = item->cmd; const struct cmd_entry *entry = cmd->entry; enum cmd_retval retval; struct cmd_find_state *fsp, fs; int flags; + char *tmp; + + if (log_get_level() > 1) { + tmp = cmd_print(cmd); + log_debug("%s %s: (%u) %s", __func__, name, item->group, tmp); + free(tmp); + } flags = !!(shared->flags & CMDQ_SHARED_CONTROL); cmdq_guard(item, "begin", flags);