diff options
author | nicm <nicm> | 2020-06-13 09:05:53 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-06-13 09:05:53 +0000 |
commit | 1c78155e70a9f72ed6c191807c2b381cf114b91f (patch) | |
tree | d1cf209a0268843216fe440b83a68467045ee244 /window.c | |
parent | d52ac7d027e40b34e7089addc4f905d03d9c1b16 (diff) | |
download | rtmux-1c78155e70a9f72ed6c191807c2b381cf114b91f.tar.gz rtmux-1c78155e70a9f72ed6c191807c2b381cf114b91f.tar.bz2 rtmux-1c78155e70a9f72ed6c191807c2b381cf114b91f.zip |
Add -b flags to insert a window before (like the existing -a for after)
to break-pane, move-window, new-window. GitHub issue 2261.
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1490,13 +1490,16 @@ winlink_clear_flags(struct winlink *wl) /* Shuffle window indexes up. */ int -winlink_shuffle_up(struct session *s, struct winlink *wl) +winlink_shuffle_up(struct session *s, struct winlink *wl, int before) { int idx, last; if (wl == NULL) return (-1); - idx = wl->idx + 1; + if (before) + idx = wl->idx; + else + idx = wl->idx + 1; /* Find the next free index. */ for (last = idx; last < INT_MAX; last++) { @@ -1509,8 +1512,9 @@ winlink_shuffle_up(struct session *s, struct winlink *wl) /* Move everything from last - 1 to idx up a bit. */ for (; last > idx; last--) { wl = winlink_find_by_index(&s->windows, last - 1); - server_link_window(s, wl, s, last, 0, 0, NULL); - server_unlink_window(s, wl); + RB_REMOVE(winlinks, &s->windows, wl); + wl->idx++; + RB_INSERT(winlinks, &s->windows, wl); } return (idx); |