diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-05-08 21:30:01 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-05-08 21:30:01 +0000 |
commit | 3dd606e1bf08988c4444090b7da2ec09aa7c71ea (patch) | |
tree | cccdedf737f5f1958430067253ab25819ec3e346 /usr.bin/tmux | |
parent | eede420c4d0fe3c9bff309d66eb1097fb2b9c5aa (diff) |
Reset last pane properly when using break-pane as well, fixes a problem
reported to Debian by Hannes von Haugwitz (bug 622677).
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/cmd-break-pane.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-break-pane.c b/usr.bin/tmux/cmd-break-pane.c index 25a032fb7b5..34b109bc358 100644 --- a/usr.bin/tmux/cmd-break-pane.c +++ b/usr.bin/tmux/cmd-break-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-break-pane.c,v 1.10 2011/01/04 00:42:46 nicm Exp $ */ +/* $OpenBSD: cmd-break-pane.c,v 1.11 2011/05/08 21:30:00 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -57,12 +57,18 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx) return (-1); } - TAILQ_REMOVE(&wl->window->panes, wp, entry); - if (wl->window->active == wp) { - wl->window->active = TAILQ_PREV(wp, window_panes, entry); - if (wl->window->active == NULL) - wl->window->active = TAILQ_NEXT(wp, entry); - } + w = wl->window; + TAILQ_REMOVE(&w->panes, wp, entry); + if (wp == w->active) { + w->active = w->last; + w->last = NULL; + if (w->active == NULL) { + w->active = TAILQ_PREV(wp, window_panes, entry); + if (w->active == NULL) + w->active = TAILQ_NEXT(wp, entry); + } + } else if (wp == w->last) + w->last = NULL; layout_close_pane(wp); w = wp->window = window_create1(s->sx, s->sy); |