mirror of
https://github.com/tmux/tmux.git
synced 2026-02-13 00:59:16 +00:00
Add -e flag to command-prompt to close if empty, from Dane Jensen in
GitHub issue 4812.
This commit is contained in:
@@ -42,8 +42,8 @@ const struct cmd_entry cmd_command_prompt_entry = {
|
||||
.name = "command-prompt",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "1bFkliI:Np:t:T:", 0, 1, cmd_command_prompt_args_parse },
|
||||
.usage = "[-1bFkliN] [-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE
|
||||
.args = { "1beFiklI:Np:t:T:", 0, 1, cmd_command_prompt_args_parse },
|
||||
.usage = "[-1beFiklN] [-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE
|
||||
" [-T prompt-type] [template]",
|
||||
|
||||
.flags = CMD_CLIENT_TFLAG,
|
||||
@@ -163,6 +163,8 @@ cmd_command_prompt_exec(struct cmd *self, struct cmdq_item *item)
|
||||
cdata->flags |= PROMPT_INCREMENTAL;
|
||||
else if (args_has(args, 'k'))
|
||||
cdata->flags |= PROMPT_KEY;
|
||||
else if (args_has(args, 'e'))
|
||||
cdata->flags |= PROMPT_BSPACE_EXIT;
|
||||
status_prompt_set(tc, target, cdata->prompts[0].prompt,
|
||||
cdata->prompts[0].input, cmd_command_prompt_callback,
|
||||
cmd_command_prompt_free, cdata, cdata->flags, cdata->prompt_type);
|
||||
|
||||
5
status.c
5
status.c
@@ -1383,6 +1383,11 @@ process_key:
|
||||
break;
|
||||
case KEYC_BSPACE:
|
||||
case 'h'|KEYC_CTRL:
|
||||
if (c->prompt_flags & PROMPT_BSPACE_EXIT && size == 0) {
|
||||
if (c->prompt_inputcb(c, c->prompt_data, NULL, 1) == 0)
|
||||
status_prompt_clear(c);
|
||||
break;
|
||||
}
|
||||
if (c->prompt_index != 0) {
|
||||
if (c->prompt_index == size)
|
||||
c->prompt_buffer[--c->prompt_index].size = 0;
|
||||
|
||||
6
tmux.1
6
tmux.1
@@ -6716,7 +6716,7 @@ See
|
||||
for possible values for
|
||||
.Ar prompt-type .
|
||||
.It Xo Ic command-prompt
|
||||
.Op Fl 1bFiklN
|
||||
.Op Fl 1beFiklN
|
||||
.Op Fl I Ar inputs
|
||||
.Op Fl p Ar prompts
|
||||
.Op Fl t Ar target-client
|
||||
@@ -6789,6 +6789,10 @@ makes the prompt only accept numeric key presses.
|
||||
.Fl i
|
||||
executes the command every time the prompt input changes instead of when the
|
||||
user exits the command prompt.
|
||||
.Fl e
|
||||
makes
|
||||
.Em BSpace
|
||||
cancel an empty prompt.
|
||||
.Pp
|
||||
.Fl T
|
||||
tells
|
||||
|
||||
Reference in New Issue
Block a user