aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-10-25 10:41:03 +0000
committerTiago Cunha <tcunha@gmx.com>2009-10-25 10:41:03 +0000
commit85ae64b9813c61a299e868aac892a80d61f847d8 (patch)
tree1fbdf129712b8aa167b71bc7367cf3f226d7006f
parent4a87cef46fa010e469b0ee584b96e324d738af48 (diff)
downloadrtmux-85ae64b9813c61a299e868aac892a80d61f847d8.tar.gz
rtmux-85ae64b9813c61a299e868aac892a80d61f847d8.tar.bz2
rtmux-85ae64b9813c61a299e868aac892a80d61f847d8.zip
Sync OpenBSD patchset 442:
-a option to kill all except current pane. From Tiago Cunha, thanks!
-rw-r--r--cmd-kill-pane.c25
-rw-r--r--tmux.113
2 files changed, 29 insertions, 9 deletions
diff --git a/cmd-kill-pane.c b/cmd-kill-pane.c
index 4fc6cb5c..26270128 100644
--- a/cmd-kill-pane.c
+++ b/cmd-kill-pane.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-pane.c,v 1.13 2009-09-20 22:15:32 tcunha Exp $ */
+/* $Id: cmd-kill-pane.c,v 1.14 2009-10-25 10:41:03 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -30,8 +30,8 @@ int cmd_kill_pane_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_kill_pane_entry = {
"kill-pane", "killp",
- CMD_TARGET_PANE_USAGE,
- 0, 0,
+ "[-a] " CMD_TARGET_PANE_USAGE,
+ 0, CMD_CHFLAG('a'),
cmd_target_init,
cmd_target_parse,
cmd_kill_pane_exec,
@@ -44,7 +44,7 @@ cmd_kill_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
struct winlink *wl;
- struct window_pane *wp;
+ struct window_pane *loopwp, *nextwp, *wp;
if ((wl = cmd_find_pane(ctx, data->target, NULL, &wp)) == NULL)
return (-1);
@@ -56,8 +56,21 @@ cmd_kill_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
return (0);
}
- layout_close_pane(wp);
- window_remove_pane(wl->window, wp);
+ if (data->chflags & CMD_CHFLAG('a')) {
+ loopwp = TAILQ_FIRST(&wl->window->panes);
+ while (loopwp != NULL) {
+ nextwp = TAILQ_NEXT(loopwp, entry);
+ if (loopwp != wp) {
+ layout_close_pane(loopwp);
+ window_remove_pane(wl->window, loopwp);
+ }
+ loopwp = nextwp;
+ }
+ } else {
+ layout_close_pane(wp);
+ window_remove_pane(wl->window, wp);
+ }
server_redraw_window(wl->window);
+
return (0);
}
diff --git a/tmux.1 b/tmux.1
index 0f4bb96d..7cf1cbb6 100644
--- a/tmux.1
+++ b/tmux.1
@@ -1,4 +1,4 @@
-.\" $Id: tmux.1,v 1.193 2009-10-23 17:24:57 tcunha Exp $
+.\" $Id: tmux.1,v 1.194 2009-10-25 10:41:03 tcunha Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -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: October 21 2009 $
+.Dd $Mdocdate: October 24 2009 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -740,10 +740,17 @@ If only one window is matched, it'll be automatically selected, otherwise a
choice list is shown.
This command only works from inside
.Nm .
-.It Ic kill-pane Op Fl t Ar target-pane
+.It Xo Ic kill-pane
+.Op Fl a
+.Op Fl t Ar target-pane
+.Xc
.D1 (alias: Ic killp )
Destroy the given pane.
If no panes remain in the containing window, it is also destroyed.
+The
+.Fl a
+option kills all but the pane given with
+.Fl t .
.It Ic kill-window Op Fl t Ar target-window
.D1 (alias: Ic killw )
Kill the current window or the window at