mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Add a -k flag to unlink-window which makes it behave the same as the old
kill-window - if a window is linked into only one session it unlinked and destroyed.
This commit is contained in:
parent
19cb1fb592
commit
17170f5d6e
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-unlink-window.c,v 1.14 2009-07-14 06:43:33 nicm Exp $ */
|
/* $Id: cmd-unlink-window.c,v 1.15 2009-07-19 00:39:37 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -28,8 +28,8 @@ int cmd_unlink_window_exec(struct cmd *, struct cmd_ctx *);
|
|||||||
|
|
||||||
const struct cmd_entry cmd_unlink_window_entry = {
|
const struct cmd_entry cmd_unlink_window_entry = {
|
||||||
"unlink-window", "unlinkw",
|
"unlink-window", "unlinkw",
|
||||||
CMD_TARGET_WINDOW_USAGE,
|
"[-k] " CMD_TARGET_WINDOW_USAGE,
|
||||||
0, 0,
|
0, CMD_CHFLAG('k'),
|
||||||
cmd_target_init,
|
cmd_target_init,
|
||||||
cmd_target_parse,
|
cmd_target_parse,
|
||||||
cmd_unlink_window_exec,
|
cmd_unlink_window_exec,
|
||||||
@ -52,7 +52,7 @@ cmd_unlink_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
|
if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
if (wl->window->references == 1) {
|
if (!(data->chflags & CMD_CHFLAG('k')) && wl->window->references == 1) {
|
||||||
ctx->error(ctx, "window is only linked to one session");
|
ctx->error(ctx, "window is only linked to one session");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
13
tmux.1
13
tmux.1
@ -1,4 +1,4 @@
|
|||||||
.\" $Id: tmux.1,v 1.121 2009-07-18 11:07:14 nicm Exp $
|
.\" $Id: tmux.1,v 1.122 2009-07-19 00:39:37 tcunha Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
.\"
|
.\"
|
||||||
@ -1583,13 +1583,20 @@ to
|
|||||||
Unbind the key bound to
|
Unbind the key bound to
|
||||||
.Ar key .
|
.Ar key .
|
||||||
.It Xo Ic unlink-window
|
.It Xo Ic unlink-window
|
||||||
|
.Op Fl k
|
||||||
.Op Fl t Ar target-window
|
.Op Fl t Ar target-window
|
||||||
.Xc
|
.Xc
|
||||||
.D1 (alias: Ic unlinkw )
|
.D1 (alias: Ic unlinkw )
|
||||||
Unlink
|
Unlink
|
||||||
.Ar target-window .
|
.Ar target-window .
|
||||||
A window may be unlinked only if it is linked to multiple sessions - windows may
|
Unless
|
||||||
not be linked to no sessions.
|
.Fl k
|
||||||
|
is given, a window may be unlinked only if it is linked to multiple sessions -
|
||||||
|
windows may not be linked to no sessions;
|
||||||
|
if
|
||||||
|
.Fl k
|
||||||
|
is specified and the window is linked to only one session, it is unlinked and
|
||||||
|
destroyed.
|
||||||
.It Xo Ic up-pane
|
.It Xo Ic up-pane
|
||||||
.Op Fl p Ar pane-index
|
.Op Fl p Ar pane-index
|
||||||
.Op Fl t Ar target-window
|
.Op Fl t Ar target-window
|
||||||
|
Loading…
x
Reference in New Issue
Block a user