mirror of
https://github.com/tmux/tmux.git
synced 2026-10-07 01:55:49 +00:00
Fix separator for args_print.
This commit is contained in:
@@ -114,8 +114,10 @@ args_value_as_string(struct args_value *value)
|
|||||||
case ARGS_NONE:
|
case ARGS_NONE:
|
||||||
return ("");
|
return ("");
|
||||||
case ARGS_COMMANDS:
|
case ARGS_COMMANDS:
|
||||||
if (value->cached == NULL)
|
if (value->cached == NULL) {
|
||||||
value->cached = cmd_parse_print(value->cmd, 0);
|
value->cached = cmd_parse_print(value->cmd,
|
||||||
|
CMD_PARSE_PRINT_RAW);
|
||||||
|
}
|
||||||
return (value->cached);
|
return (value->cached);
|
||||||
case ARGS_STRING:
|
case ARGS_STRING:
|
||||||
return (value->string);
|
return (value->string);
|
||||||
|
|||||||
@@ -1174,9 +1174,9 @@ cmd_parse_print_string(char **buf, struct cmd_parse_node *string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
cmd_parse_print_separator(u_int depth)
|
cmd_parse_print_separator(u_int depth, int flags)
|
||||||
{
|
{
|
||||||
if (depth == 0)
|
if (depth == 0 && (~flags & CMD_PARSE_PRINT_RAW))
|
||||||
return (" \\; ");
|
return (" \\; ");
|
||||||
return (" ; ");
|
return (" ; ");
|
||||||
}
|
}
|
||||||
@@ -1318,7 +1318,7 @@ cmd_parse_print_sequence(char **buf, struct cmd_parse_node *seq, u_int depth,
|
|||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
struct cmd_parse_node *child, *first_child;
|
struct cmd_parse_node *child, *first_child;
|
||||||
const char *sep = cmd_parse_print_separator(depth);
|
const char *sep = cmd_parse_print_separator(depth, flags);
|
||||||
int first = 1;
|
int first = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1343,6 +1343,7 @@ char *
|
|||||||
cmd_parse_print(struct cmd_parse_tree *tree, int flags)
|
cmd_parse_print(struct cmd_parse_tree *tree, int flags)
|
||||||
{
|
{
|
||||||
struct cmd_parse_node *root = tree->root, *child;
|
struct cmd_parse_node *root = tree->root, *child;
|
||||||
|
const char *sep = cmd_parse_print_separator(0, flags);
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
int first = 1;
|
int first = 1;
|
||||||
|
|
||||||
@@ -1351,7 +1352,7 @@ cmd_parse_print(struct cmd_parse_tree *tree, int flags)
|
|||||||
if (flags & CMD_PARSE_PRINT_MULTILINE)
|
if (flags & CMD_PARSE_PRINT_MULTILINE)
|
||||||
cmd_parse_strcat(&buf, "\n");
|
cmd_parse_strcat(&buf, "\n");
|
||||||
else
|
else
|
||||||
cmd_parse_strcat(&buf, " \\; ");
|
cmd_parse_strcat(&buf, "%s", sep);
|
||||||
}
|
}
|
||||||
first = 0;
|
first = 0;
|
||||||
cmd_parse_print_sequence(&buf, child, 0, flags);
|
cmd_parse_print_sequence(&buf, child, 0, flags);
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ enum cmd_parse_node_type {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define CMD_PARSE_PRINT_MULTILINE 0x1
|
#define CMD_PARSE_PRINT_MULTILINE 0x1
|
||||||
|
#define CMD_PARSE_PRINT_RAW 0x2
|
||||||
|
|
||||||
struct cmd_parse_tree *cmd_parse_from_file(FILE *, struct cmd_parse_input *,
|
struct cmd_parse_tree *cmd_parse_from_file(FILE *, struct cmd_parse_input *,
|
||||||
char **);
|
char **);
|
||||||
|
|||||||
Reference in New Issue
Block a user