summaryrefslogtreecommitdiffstats
path: root/cmd-rotate-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-06-03 07:51:24 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-06-03 07:51:24 +0000
commitc5dbec9e856602e7b10a5e8f8e5f70585096ffb8 (patch)
tree86359cd505db677460529f8ac7b2ec7505eb753d /cmd-rotate-window.c
parent646cfa6983fe739fbb5a908fcc412ae415248a9f (diff)
When swapping pane positions, swap the PANE_HIDDEN flag as well, otherwise tmux
crashes when trying to find the new active pane. While here, nuke an unused pane flag. Fixes PR 6160, reported by and a slightly different version of diff tested by ralf.horstmann at gmx.de.
Diffstat (limited to 'cmd-rotate-window.c')
-rw-r--r--cmd-rotate-window.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/cmd-rotate-window.c b/cmd-rotate-window.c
index 354e6942..b7ac341d 100644
--- a/cmd-rotate-window.c
+++ b/cmd-rotate-window.c
@@ -60,6 +60,7 @@ cmd_rotate_window_exec(struct cmd *self, struct cmd_ctx *ctx)
struct window *w;
struct window_pane *wp, *wp2;
u_int sx, sy, xoff, yoff;
+ int flags;
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
return (-1);
@@ -71,14 +72,19 @@ cmd_rotate_window_exec(struct cmd *self, struct cmd_ctx *ctx)
TAILQ_INSERT_HEAD(&w->panes, wp, entry);
xoff = wp->xoff; yoff = wp->yoff;
- sx = wp->sx; sy = wp->sy;
+ sx = wp->sx; sy = wp->sy;
+ flags = w->flags;
TAILQ_FOREACH(wp, &w->panes, entry) {
if ((wp2 = TAILQ_NEXT(wp, entry)) == NULL)
break;
wp->xoff = wp2->xoff; wp->yoff = wp2->yoff;
+ wp->flags &= ~PANE_HIDDEN;
+ wp->flags |= wp2->flags & PANE_HIDDEN;
window_pane_resize(wp, wp2->sx, wp2->sy);
}
wp->xoff = xoff; wp->yoff = yoff;
+ wp->flags &= ~PANE_HIDDEN;
+ wp->flags |= flags & PANE_HIDDEN;
window_pane_resize(wp, sx, sy);
if ((wp = TAILQ_PREV(w->active, window_panes, entry)) == NULL)
@@ -91,13 +97,18 @@ cmd_rotate_window_exec(struct cmd *self, struct cmd_ctx *ctx)
xoff = wp->xoff; yoff = wp->yoff;
sx = wp->sx; sy = wp->sy;
+ flags = w->flags;
TAILQ_FOREACH_REVERSE(wp, &w->panes, window_panes, entry) {
if ((wp2 = TAILQ_PREV(wp, window_panes, entry)) == NULL)
break;
wp->xoff = wp2->xoff; wp->yoff = wp2->yoff;
+ wp->flags &= ~PANE_HIDDEN;
+ wp->flags |= wp2->flags & PANE_HIDDEN;
window_pane_resize(wp, wp2->sx, wp2->sy);
}
wp->xoff = xoff; wp->yoff = yoff;
+ wp->flags &= ~PANE_HIDDEN;
+ wp->flags |= flags & PANE_HIDDEN;
window_pane_resize(wp, sx, sy);
if ((wp = TAILQ_NEXT(w->active, entry)) == NULL)