diff options
author | nicm <nicm> | 2016-12-14 17:38:59 +0000 |
---|---|---|
committer | nicm <nicm> | 2016-12-14 17:38:59 +0000 |
commit | e36f932f625e90320ccf58efc7059c7db9a37e9c (patch) | |
tree | 822140c06c72fed6c32e56ea6fd6f0ba2d22bc34 | |
parent | b851c628f483e29fb57c33cf7fb08b04c187dc32 (diff) |
Fix up winlink lists after swap-window.
-rw-r--r-- | cmd-swap-window.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/cmd-swap-window.c b/cmd-swap-window.c index 0a0fcab9..0a93fa6e 100644 --- a/cmd-swap-window.c +++ b/cmd-swap-window.c @@ -48,7 +48,7 @@ cmd_swap_window_exec(struct cmd *self, struct cmdq_item *item) struct session *src, *dst; struct session_group *sg_src, *sg_dst; struct winlink *wl_src, *wl_dst; - struct window *w; + struct window *w_src, *w_dst; wl_src = item->state.sflag.wl; src = item->state.sflag.s; @@ -67,9 +67,15 @@ cmd_swap_window_exec(struct cmd *self, struct cmdq_item *item) if (wl_dst->window == wl_src->window) return (CMD_RETURN_NORMAL); - w = wl_dst->window; - wl_dst->window = wl_src->window; - wl_src->window = w; + w_dst = wl_dst->window; + TAILQ_REMOVE(&w_dst->winlinks, wl_dst, wentry); + w_src = wl_src->window; + TAILQ_REMOVE(&w_src->winlinks, wl_src, wentry); + + wl_dst->window = w_src; + TAILQ_INSERT_TAIL(&w_src->winlinks, wl_dst, wentry); + wl_src->window = w_dst; + TAILQ_INSERT_TAIL(&w_dst->winlinks, wl_src, wentry); if (!args_has(self->args, 'd')) { session_select(dst, wl_dst->idx); |