aboutsummaryrefslogtreecommitdiff
path: root/cmd-break-pane.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2011-05-18 20:32:47 +0000
committerTiago Cunha <tcunha@gmx.com>2011-05-18 20:32:47 +0000
commit21140d426d0ae46c82ddbf5b61eea50e7084e6eb (patch)
tree927d9517280e26c867cc8a769e2d66ea66fee676 /cmd-break-pane.c
parent13d5ac6f9efac856623a7b9ea74e0d3a919ec2f9 (diff)
downloadrtmux-21140d426d0ae46c82ddbf5b61eea50e7084e6eb.tar.gz
rtmux-21140d426d0ae46c82ddbf5b61eea50e7084e6eb.tar.bz2
rtmux-21140d426d0ae46c82ddbf5b61eea50e7084e6eb.zip
Sync OpenBSD patchset 910:
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.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/cmd-break-pane.c b/cmd-break-pane.c
index 41c723a5..cd608002 100644
--- a/cmd-break-pane.c
+++ b/cmd-break-pane.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-break-pane.c,v 1.12 2011-01-07 14:45:33 tcunha Exp $ */
+/* $Id: cmd-break-pane.c,v 1.13 2011-05-18 20:32:47 tcunha 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);