aboutsummaryrefslogtreecommitdiff
path: root/cmd-command-prompt.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2021-05-10 07:52:30 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2021-05-10 07:52:30 +0100
commit4ca6b42c241c9bb6769417ca1dc4fada521f3db8 (patch)
tree8ec617cbbf0dc1579ec6b8bce5c1cd8e3669674a /cmd-command-prompt.c
parentbde3829131bd851b8210fd4a35871b01286da1eb (diff)
downloadrtmux-4ca6b42c241c9bb6769417ca1dc4fada521f3db8.tar.gz
rtmux-4ca6b42c241c9bb6769417ca1dc4fada521f3db8.tar.bz2
rtmux-4ca6b42c241c9bb6769417ca1dc4fada521f3db8.zip
Add -F for command-prompt and use it to fix "Rename" on the window menu, GitHub
issue 2699.
Diffstat (limited to 'cmd-command-prompt.c')
-rw-r--r--cmd-command-prompt.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c
index c2a2dec7..a955ac32 100644
--- a/cmd-command-prompt.c
+++ b/cmd-command-prompt.c
@@ -40,8 +40,8 @@ const struct cmd_entry cmd_command_prompt_entry = {
.name = "command-prompt",
.alias = NULL,
- .args = { "1kiI:Np:t:T:", 0, 1 },
- .usage = "[-1kiN] [-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE
+ .args = { "1FkiI:Np:t:T:", 0, 1 },
+ .usage = "[-1FkiN] [-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE
" [-T type] [template]",
.flags = CMD_CLIENT_TFLAG,
@@ -59,7 +59,7 @@ struct cmd_command_prompt_cdata {
char *next_prompt;
char *template;
- int idx;
+ int idx;
};
static enum cmd_retval
@@ -87,7 +87,9 @@ cmd_command_prompt_exec(struct cmd *self, struct cmdq_item *item)
cdata->template = NULL;
cdata->idx = 1;
- if (args->argc != 0)
+ if (args->argc != 0 && args_has(args, 'F'))
+ cdata->template = format_single_from_target(item, args->argv[0]);
+ else if (args->argc != 0)
cdata->template = xstrdup(args->argv[0]);
else
cdata->template = xstrdup("%1");