mirror of
https://github.com/openbsd/src.git
synced 2026-06-18 07:13:36 +02:00
Add a -k flag to choose commands to kill the pane when the mode is
exited (useful with floating panes).
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cmd-choose-tree.c,v 1.53 2026/02/27 08:25:12 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-choose-tree.c,v 1.54 2026/06/08 20:38:54 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 Thomas Adam <thomas@xteddy.org>
|
||||
@@ -33,8 +33,8 @@ const struct cmd_entry cmd_choose_tree_entry = {
|
||||
.name = "choose-tree",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "F:f:GK:NO:rst:wyZ", 0, 1, cmd_choose_tree_args_parse },
|
||||
.usage = "[-GNrswZ] [-F format] [-f filter] [-K key-format] "
|
||||
.args = { "F:f:GK:kNO:rst:wyZ", 0, 1, cmd_choose_tree_args_parse },
|
||||
.usage = "[-GkNrswZ] [-F format] [-f filter] [-K key-format] "
|
||||
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
|
||||
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
@@ -47,8 +47,8 @@ const struct cmd_entry cmd_choose_client_entry = {
|
||||
.name = "choose-client",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "F:f:K:NO:rt:yZ", 0, 1, cmd_choose_tree_args_parse },
|
||||
.usage = "[-NrZ] [-F format] [-f filter] [-K key-format] "
|
||||
.args = { "F:f:K:kNO:rt:yZ", 0, 1, cmd_choose_tree_args_parse },
|
||||
.usage = "[-kNrZ] [-F format] [-f filter] [-K key-format] "
|
||||
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
|
||||
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
@@ -61,8 +61,8 @@ const struct cmd_entry cmd_choose_buffer_entry = {
|
||||
.name = "choose-buffer",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "F:f:K:NO:rt:yZ", 0, 1, cmd_choose_tree_args_parse },
|
||||
.usage = "[-NrZ] [-F format] [-f filter] [-K key-format] "
|
||||
.args = { "F:f:K:kNO:rt:yZ", 0, 1, cmd_choose_tree_args_parse },
|
||||
.usage = "[-kNrZ] [-F format] [-f filter] [-K key-format] "
|
||||
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
|
||||
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
@@ -75,8 +75,8 @@ const struct cmd_entry cmd_customize_mode_entry = {
|
||||
.name = "customize-mode",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "F:f:Nt:yZ", 0, 0, NULL },
|
||||
.usage = "[-NZ] [-F format] [-f filter] " CMD_TARGET_PANE_USAGE,
|
||||
.args = { "F:f:kNt:yZ", 0, 0, NULL },
|
||||
.usage = "[-kNZ] [-F format] [-f filter] " CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
|
||||
+14
-6
@@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: tmux.1,v 1.1068 2026/06/07 20:03:02 nicm Exp $
|
||||
.\" $OpenBSD: tmux.1,v 1.1069 2026/06/08 20:38:54 nicm Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
.\"
|
||||
@@ -14,7 +14,7 @@
|
||||
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: June 7 2026 $
|
||||
.Dd $Mdocdate: June 8 2026 $
|
||||
.Dt TMUX 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -2741,7 +2741,7 @@ the end of the visible pane.
|
||||
The default is to capture only the visible contents of the pane.
|
||||
.It Xo
|
||||
.Ic choose\-client
|
||||
.Op Fl NryZ
|
||||
.Op Fl kNryZ
|
||||
.Op Fl F Ar format
|
||||
.Op Fl f Ar filter
|
||||
.Op Fl K Ar key\-format
|
||||
@@ -2814,10 +2814,12 @@ specifies the format for each item in the list and
|
||||
a format for each shortcut key; both are evaluated once for each line.
|
||||
.Fl N
|
||||
starts without the preview or if given twice with the larger preview.
|
||||
.Fl k
|
||||
kills the pane when the mode is exited.
|
||||
This command works only if at least one client is attached.
|
||||
.It Xo
|
||||
.Ic choose\-tree
|
||||
.Op Fl GNrswyZ
|
||||
.Op Fl GkNrswyZ
|
||||
.Op Fl F Ar format
|
||||
.Op Fl f Ar filter
|
||||
.Op Fl K Ar key\-format
|
||||
@@ -2907,10 +2909,12 @@ starts without the preview or if given twice with the larger preview.
|
||||
.Fl G
|
||||
includes all sessions in any session groups in the tree rather than only the
|
||||
first.
|
||||
.Fl k
|
||||
kills the pane when the mode is exited.
|
||||
This command works only if at least one client is attached.
|
||||
.It Xo
|
||||
.Ic customize\-mode
|
||||
.Op Fl NZ
|
||||
.Op Fl kNZ
|
||||
.Op Fl F Ar format
|
||||
.Op Fl f Ar filter
|
||||
.Op Fl t Ar target\-pane
|
||||
@@ -2958,6 +2962,8 @@ If a filter would lead to an empty list, it is ignored.
|
||||
specifies the format for each item in the tree.
|
||||
.Fl N
|
||||
starts without the option information.
|
||||
.Fl k
|
||||
kills the pane when the mode is exited.
|
||||
This command works only if at least one client is attached.
|
||||
.It Xo
|
||||
.Tg displayp
|
||||
@@ -7615,7 +7621,7 @@ The buffer commands are as follows:
|
||||
.Bl -tag -width Ds
|
||||
.It Xo
|
||||
.Ic choose\-buffer
|
||||
.Op Fl NryZ
|
||||
.Op Fl kNryZ
|
||||
.Op Fl F Ar format
|
||||
.Op Fl f Ar filter
|
||||
.Op Fl K Ar key\-format
|
||||
@@ -7686,6 +7692,8 @@ specifies the format for each item in the list and
|
||||
a format for each shortcut key; both are evaluated once for each line.
|
||||
.Fl N
|
||||
starts without the preview.
|
||||
.Fl k
|
||||
kills the pane when the mode is exited.
|
||||
This command works only if at least one client is attached.
|
||||
.Tg clearhist
|
||||
.It Xo Ic clear\-history
|
||||
|
||||
+3
-1
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: tmux.h,v 1.1336 2026/06/07 20:03:02 nicm Exp $ */
|
||||
/* $OpenBSD: tmux.h,v 1.1337 2026/06/08 20:38:54 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -1147,6 +1147,8 @@ struct window_mode_entry {
|
||||
struct screen *screen;
|
||||
u_int prefix;
|
||||
|
||||
int kill;
|
||||
|
||||
TAILQ_ENTRY(window_mode_entry) entry;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: window.c,v 1.329 2026/06/02 19:25:06 nicm Exp $ */
|
||||
/* $OpenBSD: window.c,v 1.330 2026/06/08 20:38:54 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -1213,6 +1213,7 @@ window_pane_set_mode(struct window_pane *wp, struct window_pane *swp,
|
||||
TAILQ_INSERT_HEAD(&wp->modes, wme, entry);
|
||||
wme->screen = wme->mode->init(wme, fs, args);
|
||||
}
|
||||
wme->kill = args_has(args, 'k');
|
||||
wp->screen = wme->screen;
|
||||
|
||||
wp->flags |= (PANE_REDRAW|PANE_REDRAWSCROLLBAR|PANE_CHANGED);
|
||||
@@ -1230,11 +1231,13 @@ window_pane_reset_mode(struct window_pane *wp)
|
||||
{
|
||||
struct window_mode_entry *wme, *next;
|
||||
struct window *w = wp->window;
|
||||
int kill;
|
||||
|
||||
if (TAILQ_EMPTY(&wp->modes))
|
||||
return;
|
||||
|
||||
wme = TAILQ_FIRST(&wp->modes);
|
||||
kill = wme->kill;
|
||||
TAILQ_REMOVE(&wp->modes, wme, entry);
|
||||
wme->mode->free(wme);
|
||||
free(wme);
|
||||
@@ -1257,6 +1260,9 @@ window_pane_reset_mode(struct window_pane *wp)
|
||||
server_redraw_window_borders(wp->window);
|
||||
server_status_window(wp->window);
|
||||
notify_pane("pane-mode-changed", wp);
|
||||
|
||||
if (kill)
|
||||
server_kill_pane(wp);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user