aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicm <nicm>2021-08-21 14:06:17 +0000
committernicm <nicm>2021-08-21 14:06:17 +0000
commitc286fbdcd778c0d3d6b60a9f8682b413078e4639 (patch)
tree823a1858cad8172d2e791f241e220138be19b720
parent110ba767e591946d6784acef87737850f2ad3ae9 (diff)
downloadrtmux-c286fbdcd778c0d3d6b60a9f8682b413078e4639.tar.gz
rtmux-c286fbdcd778c0d3d6b60a9f8682b413078e4639.tar.bz2
rtmux-c286fbdcd778c0d3d6b60a9f8682b413078e4639.zip
Preserve command group when moving temporary list to current list being
buit.
-rw-r--r--cmd-parse.y2
-rw-r--r--cmd.c13
-rw-r--r--tmux.h1
3 files changed, 14 insertions, 2 deletions
diff --git a/cmd-parse.y b/cmd-parse.y
index 6d1fec7e..458092b4 100644
--- a/cmd-parse.y
+++ b/cmd-parse.y
@@ -871,7 +871,7 @@ cmd_parse_build_commands(struct cmd_parse_commands *cmds,
cmd_list_free(current);
return;
}
- cmd_list_move(current, add);
+ cmd_list_append_all(current, add);
cmd_list_free(add);
}
if (current != NULL) {
diff --git a/cmd.c b/cmd.c
index 29f2d130..52c5ad74 100644
--- a/cmd.c
+++ b/cmd.c
@@ -594,7 +594,18 @@ cmd_list_append(struct cmd_list *cmdlist, struct cmd *cmd)
TAILQ_INSERT_TAIL(cmdlist->list, cmd, qentry);
}
-/* Move all commands from one command list to another */
+/* Append all commands from one list to another. */
+void
+cmd_list_append_all(struct cmd_list *cmdlist, struct cmd_list *from)
+{
+ struct cmd *cmd;
+
+ TAILQ_FOREACH(cmd, from->list, qentry)
+ cmd->group = cmdlist->group;
+ TAILQ_CONCAT(cmdlist->list, from->list, qentry);
+}
+
+/* Move all commands from one command list to another. */
void
cmd_list_move(struct cmd_list *cmdlist, struct cmd_list *from)
{
diff --git a/tmux.h b/tmux.h
index fb1631f9..3a825526 100644
--- a/tmux.h
+++ b/tmux.h
@@ -2256,6 +2256,7 @@ void cmd_free(struct cmd *);
char *cmd_print(struct cmd *);
struct cmd_list *cmd_list_new(void);
void cmd_list_append(struct cmd_list *, struct cmd *);
+void cmd_list_append_all(struct cmd_list *, struct cmd_list *);
void cmd_list_move(struct cmd_list *, struct cmd_list *);
void cmd_list_free(struct cmd_list *);
char *cmd_list_print(struct cmd_list *, int);