diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-06-03 07:51:24 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-06-03 07:51:24 +0000 |
commit | c5dbec9e856602e7b10a5e8f8e5f70585096ffb8 (patch) | |
tree | 86359cd505db677460529f8ac7b2ec7505eb753d /cmd-swap-pane.c | |
parent | 646cfa6983fe739fbb5a908fcc412ae415248a9f (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-swap-pane.c')
-rw-r--r-- | cmd-swap-pane.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c index 0a34d14d..e2f572dc 100644 --- a/cmd-swap-pane.c +++ b/cmd-swap-pane.c @@ -158,6 +158,7 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx) struct window *w; struct window_pane *tmp_wp, *src_wp, *dst_wp; u_int xx, yy; + int flags; if (data == NULL) return (0); @@ -209,10 +210,15 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx) xx = src_wp->xoff; yy = src_wp->yoff; + flags = src_wp->flags; src_wp->xoff = dst_wp->xoff; src_wp->yoff = dst_wp->yoff; + src_wp->flags &= ~PANE_HIDDEN; + src_wp->flags |= dst_wp->flags & PANE_HIDDEN; dst_wp->xoff = xx; dst_wp->yoff = yy; + dst_wp->flags &= ~PANE_HIDDEN; + dst_wp->flags |= flags & PANE_HIDDEN; xx = src_wp->sx; yy = src_wp->sy; @@ -220,7 +226,10 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx) window_pane_resize(dst_wp, xx, yy); if (!data->flag_detached) { - window_set_active_pane(w, dst_wp); + tmp_wp = dst_wp; + if (tmp_wp->flags & PANE_HIDDEN) + tmp_wp = src_wp; + window_set_active_pane(w, tmp_wp); layout_refresh(w, 0); } |