summaryrefslogtreecommitdiffstats
path: root/cmd-break-pane.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2011-05-08 21:30:00 +0000
committerNicholas Marriott <nicm@openbsd.org>2011-05-08 21:30:00 +0000
commitec3efab01ec12aaf6ee0cf8174efdb71b2293190 (patch)
tree937ea8d0b3839a419260782c6f6ab59d1ec95e24 /cmd-break-pane.c
parent583c885d68bc567789451db25e49a3fac36f194c (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 'cmd-break-pane.c')
-rw-r--r--cmd-break-pane.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/cmd-break-pane.c b/cmd-break-pane.c
index 4c57a116..f6663149 100644
--- a/cmd-break-pane.c
+++ b/cmd-break-pane.c
@@ -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);