Sync OpenBSD patchset 144:

Move the offsets as well when swapping panes.
This commit is contained in:
Tiago Cunha 2009-07-20 15:48:54 +00:00
parent 95d593dd51
commit 16f424d25d

View File

@ -1,4 +1,4 @@
/* $Id: cmd-swap-pane.c,v 1.9 2009-07-20 15:42:05 tcunha Exp $ */ /* $Id: cmd-swap-pane.c,v 1.10 2009-07-20 15:48:54 tcunha Exp $ */
/* /*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -158,7 +158,7 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
struct window *w; struct window *w;
struct window_pane *tmp_wp, *src_wp, *dst_wp; struct window_pane *tmp_wp, *src_wp, *dst_wp;
struct layout_cell *lc; struct layout_cell *lc;
u_int xx, yy; u_int sx, sy, xoff, yoff;
if (data == NULL) if (data == NULL)
return (0); return (0);
@ -209,8 +209,6 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
TAILQ_INSERT_AFTER(&w->panes, tmp_wp, src_wp, entry); TAILQ_INSERT_AFTER(&w->panes, tmp_wp, src_wp, entry);
lc = src_wp->layout_cell; lc = src_wp->layout_cell;
xx = src_wp->xoff;
yy = src_wp->yoff;
src_wp->layout_cell = dst_wp->layout_cell; src_wp->layout_cell = dst_wp->layout_cell;
if (src_wp->layout_cell != NULL) if (src_wp->layout_cell != NULL)
src_wp->layout_cell->wp = src_wp; src_wp->layout_cell->wp = src_wp;
@ -218,10 +216,12 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
if (dst_wp->layout_cell != NULL) if (dst_wp->layout_cell != NULL)
dst_wp->layout_cell->wp = dst_wp; dst_wp->layout_cell->wp = dst_wp;
xx = src_wp->sx; sx = src_wp->sx; sy = src_wp->sy;
yy = src_wp->sy; xoff = src_wp->xoff; yoff = src_wp->yoff;
src_wp->xoff = dst_wp->xoff; src_wp->yoff = dst_wp->yoff;
window_pane_resize(src_wp, dst_wp->sx, dst_wp->sy); window_pane_resize(src_wp, dst_wp->sx, dst_wp->sy);
window_pane_resize(dst_wp, xx, yy); dst_wp->xoff = xoff; dst_wp->yoff = yoff;
window_pane_resize(dst_wp, sx, sy);
if (!data->flag_detached) { if (!data->flag_detached) {
tmp_wp = dst_wp; tmp_wp = dst_wp;