From 75a200f26f06a195834b0c7a1259b59141029e04 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 23 Apr 2012 22:10:46 +0000 Subject: Add -a flag to kill-window, from Thomas Adam. --- usr.bin/tmux/cmd-kill-window.c | 18 ++++++++++++------ usr.bin/tmux/tmux.1 | 13 ++++++++++--- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/tmux/cmd-kill-window.c b/usr.bin/tmux/cmd-kill-window.c index b67c609b19b..1648d462c51 100644 --- a/usr.bin/tmux/cmd-kill-window.c +++ b/usr.bin/tmux/cmd-kill-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-kill-window.c,v 1.8 2011/01/04 00:42:46 nicm Exp $ */ +/* $OpenBSD: cmd-kill-window.c,v 1.9 2012/04/23 22:10:45 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -28,8 +28,8 @@ int cmd_kill_window_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_kill_window_entry = { "kill-window", "killw", - "t:", 0, 0, - CMD_TARGET_WINDOW_USAGE, + "at:", 0, 0, + "[-a] " CMD_TARGET_WINDOW_USAGE, 0, NULL, NULL, @@ -40,13 +40,19 @@ int cmd_kill_window_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; - struct winlink *wl; + struct winlink *wl, *wl2; if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL) return (-1); - server_kill_window(wl->window); - recalculate_sizes(); + if (args_has(args, 'a')) { + RB_FOREACH(wl2, winlinks, &ctx->curclient->session->windows) { + if (wl != wl2) + server_kill_window(wl2->window); + } + } else + server_kill_window(wl->window); + recalculate_sizes(); return (0); } diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index dfac587acdf..f5c5a45ef8d 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.288 2012/04/01 13:18:38 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.289 2012/04/23 22:10:45 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -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: April 1 2012 $ +.Dd $Mdocdate: April 23 2012 $ .Dt TMUX 1 .Os .Sh NAME @@ -1157,11 +1157,18 @@ The .Fl a option kills all but the pane given with .Fl t . -.It Ic kill-window Op Fl t Ar target-window +.It Xo Ic kill-window +.Op Fl a +.Op Fl t Ar target-window +.Xc .D1 (alias: Ic killw ) Kill the current window or the window at .Ar target-window , removing it from any sessions to which it is linked. +The +.Fl a +option kills all but the window given with +.Fl t . .It Ic last-pane Op Fl t Ar target-window .D1 (alias: Ic lastp ) Select the last (previously selected) pane. -- cgit v1.2.3