aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2015-06-17 20:01:12 +0100
committerThomas Adam <thomas@xteddy.org>2015-06-17 20:01:12 +0100
commit21a2ccc5f16be454ed7a2fd47e65a51d5faa4597 (patch)
tree8e58252b5da492a2e4e0ed5fdc35e098ca05bfc1 /window.c
parenta584e11d6bb5d2ab0e0476f6c1a821e865597053 (diff)
parent84f0622c852761a2d6688e944bc01a03af78c52a (diff)
downloadrtmux-21a2ccc5f16be454ed7a2fd47e65a51d5faa4597.tar.gz
rtmux-21a2ccc5f16be454ed7a2fd47e65a51d5faa4597.tar.bz2
rtmux-21a2ccc5f16be454ed7a2fd47e65a51d5faa4597.zip
Merge branch 'obsd-master'
Diffstat (limited to 'window.c')
-rw-r--r--window.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/window.c b/window.c
index 23da0ef9..fab9949e 100644
--- a/window.c
+++ b/window.c
@@ -1392,3 +1392,28 @@ winlink_clear_flags(struct winlink *wl)
}
}
}
+
+int
+winlink_shuffle_up(struct session *s, struct winlink *wl)
+{
+ int idx, last;
+
+ idx = wl->idx + 1;
+
+ /* Find the next free index. */
+ for (last = idx; last < INT_MAX; last++) {
+ if (winlink_find_by_index(&s->windows, last) == NULL)
+ break;
+ }
+ if (last == INT_MAX)
+ return (-1);
+
+ /* 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);
+ }
+
+ return (idx);
+}