1
0
mirror of https://github.com/tmux/tmux.git synced 2025-04-10 11:08:49 +00:00

Move the offsets as well when swapping panes.

This commit is contained in:
Nicholas Marriott 2009-07-20 07:13:31 +00:00
parent 550b855c9d
commit ff2cc0e387

View File

@ -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;