mirror of
https://github.com/tmux/tmux.git
synced 2026-06-20 17:25:57 +00:00
Add a way to quote for command arguments and use for key in list-keys,
GitHub issue 5153.
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
"," \
|
||||
"bind-key #{?key_has_repeat,#{?key_repeat,-r, },} " \
|
||||
"-T #{p|#{key_table_width}:key_table} " \
|
||||
"#{p|#{key_string_width}:key_string} " \
|
||||
"#{p|#{key_string_width}:#{q|a:key_string}} " \
|
||||
"#{key_command}}"
|
||||
|
||||
static enum cmd_retval cmd_list_keys_exec(struct cmd *, struct cmdq_item *);
|
||||
|
||||
8
format.c
8
format.c
@@ -116,6 +116,7 @@ format_job_cmp(struct format_job *fj1, struct format_job *fj2)
|
||||
#define FORMAT_NOT 0x80000
|
||||
#define FORMAT_NOT_NOT 0x100000
|
||||
#define FORMAT_REPEAT 0x200000
|
||||
#define FORMAT_QUOTE_ARGUMENTS 0x400000
|
||||
|
||||
/* Limit on recursion. */
|
||||
#define FORMAT_LOOP_LIMIT 100
|
||||
@@ -4164,6 +4165,11 @@ found:
|
||||
found = format_quote_style(saved);
|
||||
free(saved);
|
||||
}
|
||||
if (modifiers & FORMAT_QUOTE_ARGUMENTS) {
|
||||
saved = found;
|
||||
found = args_escape(saved);
|
||||
free(saved);
|
||||
}
|
||||
return (found);
|
||||
}
|
||||
|
||||
@@ -5137,6 +5143,8 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen,
|
||||
else if (strchr(fm->argv[0], 'e') != NULL ||
|
||||
strchr(fm->argv[0], 'h') != NULL)
|
||||
modifiers |= FORMAT_QUOTE_STYLE;
|
||||
else if (strchr(fm->argv[0], 'a') != NULL)
|
||||
modifiers |= FORMAT_QUOTE_ARGUMENTS;
|
||||
break;
|
||||
case 'E':
|
||||
modifiers |= FORMAT_EXPAND;
|
||||
|
||||
9
tmux.1
9
tmux.1
@@ -6286,12 +6286,17 @@ of the variable respectively.
|
||||
.Ql q:\&
|
||||
will escape
|
||||
.Xr sh 1
|
||||
special characters or with a
|
||||
special characters; with a
|
||||
.Ql h
|
||||
suffix, escape hash characters (so
|
||||
.Ql #
|
||||
becomes
|
||||
.Ql ## ) .
|
||||
.Ql ## ) ;
|
||||
or with
|
||||
.Ql a
|
||||
escape
|
||||
.Nm
|
||||
command arguments.
|
||||
.Ql E:\&
|
||||
will expand the format twice, for example
|
||||
.Ql #{E:status\-left}
|
||||
|
||||
Reference in New Issue
Block a user