mirror of
https://github.com/tmux/tmux.git
synced 2026-01-11 16:30:22 +00:00
Minor tidying of cmd_list_print from Pavel Roskin.
This commit is contained in:
17
cmd.c
17
cmd.c
@@ -682,6 +682,9 @@ cmd_list_print(const struct cmd_list *cmdlist, int escaped)
|
|||||||
struct cmd *cmd, *next;
|
struct cmd *cmd, *next;
|
||||||
char *buf, *this;
|
char *buf, *this;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
const char *separator;
|
||||||
|
const char *single_separator = escaped ? " \\; " : " ; ";
|
||||||
|
const char *double_separator = escaped ? " \\;\\; " : " ;; ";
|
||||||
|
|
||||||
len = 1;
|
len = 1;
|
||||||
buf = xcalloc(1, len);
|
buf = xcalloc(1, len);
|
||||||
@@ -696,17 +699,11 @@ cmd_list_print(const struct cmd_list *cmdlist, int escaped)
|
|||||||
|
|
||||||
next = TAILQ_NEXT(cmd, qentry);
|
next = TAILQ_NEXT(cmd, qentry);
|
||||||
if (next != NULL) {
|
if (next != NULL) {
|
||||||
if (cmd->group != next->group) {
|
if (cmd->group != next->group)
|
||||||
if (escaped)
|
separator = double_separator;
|
||||||
strlcat(buf, " \\;\\; ", len);
|
|
||||||
else
|
else
|
||||||
strlcat(buf, " ;; ", len);
|
separator = single_separator;
|
||||||
} else {
|
strlcat(buf, separator, len);
|
||||||
if (escaped)
|
|
||||||
strlcat(buf, " \\; ", len);
|
|
||||||
else
|
|
||||||
strlcat(buf, " ; ", len);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(this);
|
free(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user