-/* $OpenBSD: cmd-choose-tree.c,v 1.51 2022/06/04 07:42:07 nicm Exp $ */
+/* $OpenBSD: cmd-choose-tree.c,v 1.52 2024/10/04 19:16:13 nicm Exp $ */
/*
* Copyright (c) 2012 Thomas Adam <thomas@xteddy.org>
.name = "choose-tree",
.alias = NULL,
- .args = { "F:f:GK:NO:rst:wZ", 0, 1, cmd_choose_tree_args_parse },
+ .args = { "F:f:GK:NO:rst:wyZ", 0, 1, cmd_choose_tree_args_parse },
.usage = "[-GNrswZ] [-F format] [-f filter] [-K key-format] "
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
.name = "choose-client",
.alias = NULL,
- .args = { "F:f:K:NO:rt:Z", 0, 1, cmd_choose_tree_args_parse },
+ .args = { "F:f:K:NO:rt:yZ", 0, 1, cmd_choose_tree_args_parse },
.usage = "[-NrZ] [-F format] [-f filter] [-K key-format] "
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
.name = "choose-buffer",
.alias = NULL,
- .args = { "F:f:K:NO:rt:Z", 0, 1, cmd_choose_tree_args_parse },
+ .args = { "F:f:K:NO:rt:yZ", 0, 1, cmd_choose_tree_args_parse },
.usage = "[-NrZ] [-F format] [-f filter] [-K key-format] "
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
.name = "customize-mode",
.alias = NULL,
- .args = { "F:f:Nt:Z", 0, 0, NULL },
+ .args = { "F:f:Nt:yZ", 0, 0, NULL },
.usage = "[-NZ] [-F format] [-f filter] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
-/* $OpenBSD: status.c,v 1.245 2024/08/22 09:05:51 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.246 2024/10/04 19:16:13 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
return (1);
}
+/* Accept prompt immediately. */
+static enum cmd_retval
+status_prompt_accept(__unused struct cmdq_item *item, void *data)
+{
+ struct client *c = data;
+
+ if (c->prompt_string != NULL) {
+ c->prompt_inputcb(c, c->prompt_data, "y", 1);
+ status_prompt_clear(c);
+ }
+ return (CMD_RETURN_NORMAL);
+}
+
/* Enable status line prompt. */
void
status_prompt_set(struct client *c, struct cmd_find_state *fs,
free(tmp);
format_free(ft);
+
+ if ((flags & PROMPT_SINGLE) && (flags & PROMPT_ACCEPT))
+ cmdq_append(c, cmdq_get_callback(status_prompt_accept, c));
}
/* Remove status line prompt. */
-.\" $OpenBSD: tmux.1,v 1.959 2024/10/04 07:03:08 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.960 2024/10/04 19:16:13 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
The default is to capture only the visible contents of the pane.
.It Xo
.Ic choose-client
-.Op Fl NrZ
+.Op Fl NryZ
.Op Fl F Ar format
.Op Fl f Ar filter
.Op Fl K Ar key-format
the keys below.
.Fl Z
zooms the pane.
+.Fl y
+disables any confirmation prompts.
The following keys may be used in client mode:
.Bl -column "Key" "Function" -offset indent
.It Sy "Key" Ta Sy "Function"
This command works only if at least one client is attached.
.It Xo
.Ic choose-tree
-.Op Fl GNrswZ
+.Op Fl GNrswyZ
.Op Fl F Ar format
.Op Fl f Ar filter
.Op Fl K Ar key-format
with windows collapsed.
.Fl Z
zooms the pane.
+.Fl y
+disables any confirmation prompts.
The following keys may be used in tree mode:
.Bl -column "Key" "Function" -offset indent
.It Sy "Key" Ta Sy "Function"
.Bl -tag -width Ds
.It Xo
.Ic choose-buffer
-.Op Fl NZr
+.Op Fl NryZ
.Op Fl F Ar format
.Op Fl f Ar filter
.Op Fl K Ar key-format
the keys below.
.Fl Z
zooms the pane.
+.Fl y
+disables any confirmation prompts.
The following keys may be used in buffer mode:
.Bl -column "Key" "Function" -offset indent
.It Sy "Key" Ta Sy "Function"
-/* $OpenBSD: tmux.h,v 1.1232 2024/10/02 11:48:16 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1233 2024/10/04 19:16:13 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
#define PROMPT_INCREMENTAL 0x4
#define PROMPT_NOFORMAT 0x8
#define PROMPT_KEY 0x10
+#define PROMPT_ACCEPT 0x20
int prompt_flags;
enum prompt_type prompt_type;
int prompt_cursor;
-/* $OpenBSD: window-customize.c,v 1.14 2022/03/24 12:07:25 nicm Exp $ */
+/* $OpenBSD: window-customize.c,v 1.15 2024/10/04 19:16:13 nicm Exp $ */
/*
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
struct mode_tree_data *data;
char *format;
int hide_global;
+ int prompt_flags;
struct window_customize_itemdata **item_list;
u_int item_size;
data->format = xstrdup(WINDOW_CUSTOMIZE_DEFAULT_FORMAT);
else
data->format = xstrdup(args_get(args, 'F'));
+ if (args_has(args, 'y'))
+ data->prompt_flags = PROMPT_ACCEPT;
data->data = mode_tree_start(wp, args, window_customize_build,
window_customize_draw, NULL, window_customize_menu,
status_prompt_set(c, NULL, prompt, "",
window_customize_change_current_callback,
window_customize_free_callback, data,
- PROMPT_SINGLE|PROMPT_NOFORMAT, PROMPT_TYPE_COMMAND);
+ PROMPT_SINGLE|PROMPT_NOFORMAT|data->prompt_flags,
+ PROMPT_TYPE_COMMAND);
free(prompt);
break;
case 'D':
status_prompt_set(c, NULL, prompt, "",
window_customize_change_tagged_callback,
window_customize_free_callback, data,
- PROMPT_SINGLE|PROMPT_NOFORMAT, PROMPT_TYPE_COMMAND);
+ PROMPT_SINGLE|PROMPT_NOFORMAT|data->prompt_flags,
+ PROMPT_TYPE_COMMAND);
free(prompt);
break;
case 'u':
status_prompt_set(c, NULL, prompt, "",
window_customize_change_current_callback,
window_customize_free_callback, data,
- PROMPT_SINGLE|PROMPT_NOFORMAT, PROMPT_TYPE_COMMAND);
+ PROMPT_SINGLE|PROMPT_NOFORMAT|data->prompt_flags,
+ PROMPT_TYPE_COMMAND);
free(prompt);
break;
case 'U':
status_prompt_set(c, NULL, prompt, "",
window_customize_change_tagged_callback,
window_customize_free_callback, data,
- PROMPT_SINGLE|PROMPT_NOFORMAT, PROMPT_TYPE_COMMAND);
+ PROMPT_SINGLE|PROMPT_NOFORMAT|data->prompt_flags,
+ PROMPT_TYPE_COMMAND);
free(prompt);
break;
case 'H':
-/* $OpenBSD: window-tree.c,v 1.63 2023/06/30 21:55:09 nicm Exp $ */
+/* $OpenBSD: window-tree.c,v 1.64 2024/10/04 19:16:13 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
char *key_format;
char *command;
int squash_groups;
+ int prompt_flags;
struct window_tree_itemdata **item_list;
u_int item_size;
else
data->command = xstrdup(args_string(args, 0));
data->squash_groups = !args_has(args, 'G');
+ if (args_has(args, 'y'))
+ data->prompt_flags = PROMPT_ACCEPT;
data->data = mode_tree_start(wp, args, window_tree_build,
window_tree_draw, window_tree_search, window_tree_menu, NULL,
data->references++;
status_prompt_set(c, NULL, prompt, "",
window_tree_kill_current_callback, window_tree_command_free,
- data, PROMPT_SINGLE|PROMPT_NOFORMAT, PROMPT_TYPE_COMMAND);
+ data, PROMPT_SINGLE|PROMPT_NOFORMAT|data->prompt_flags,
+ PROMPT_TYPE_COMMAND);
free(prompt);
break;
case 'X':
data->references++;
status_prompt_set(c, NULL, prompt, "",
window_tree_kill_tagged_callback, window_tree_command_free,
- data, PROMPT_SINGLE|PROMPT_NOFORMAT, PROMPT_TYPE_COMMAND);
+ data, PROMPT_SINGLE|PROMPT_NOFORMAT|data->prompt_flags,
+ PROMPT_TYPE_COMMAND);
free(prompt);
break;
case ':':