aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'window.c')
-rw-r--r--window.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/window.c b/window.c
index 36ad4adb..320da2a2 100644
--- a/window.c
+++ b/window.c
@@ -172,6 +172,28 @@ winlink_previous(struct winlink *wl)
return (RB_PREV(winlinks, wwl, wl));
}
+struct winlink *
+winlink_next_by_number(struct winlink *wl, int n)
+{
+ for (; n > 0; n--) {
+ if ((wl = RB_NEXT(winlinks, wwl, wl)) == NULL)
+ break;
+ }
+
+ return (wl);
+}
+
+struct winlink *
+winlink_previous_by_number(struct winlink *wl, int n)
+{
+ for (; n > 0; n--) {
+ if ((wl = RB_PREV(winlinks, wwl, wl)) == NULL)
+ break;
+ }
+
+ return (wl);
+}
+
void
winlink_stack_push(struct winlink_stack *stack, struct winlink *wl)
{