summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-swap-pane.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tmux/cmd-swap-pane.c')
-rw-r--r--usr.bin/tmux/cmd-swap-pane.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-swap-pane.c b/usr.bin/tmux/cmd-swap-pane.c
index 62852a198ed..332c2e3851a 100644
--- a/usr.bin/tmux/cmd-swap-pane.c
+++ b/usr.bin/tmux/cmd-swap-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-swap-pane.c,v 1.1 2009/06/01 22:58:49 nicm Exp $ */
+/* $OpenBSD: cmd-swap-pane.c,v 1.2 2009/06/03 07:51:24 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);
}