aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-06-22 23:29:05 +0000
committerTiago Cunha <tcunha@gmx.com>2010-06-22 23:29:05 +0000
commit8d3b726396d3f5124d31a792a5f3358357f2e105 (patch)
treeb806d76a5a0c4aa3aef66b1435dad31507d2169e /window.c
parent47b335dee7e794135e03cc0f5806483e55572b9f (diff)
downloadrtmux-8d3b726396d3f5124d31a792a5f3358357f2e105.tar.gz
rtmux-8d3b726396d3f5124d31a792a5f3358357f2e105.tar.bz2
rtmux-8d3b726396d3f5124d31a792a5f3358357f2e105.zip
Sync OpenBSD patchset 725:
Extend the -t:+ and -t:- window targets for next and previous window to accept an offset such as -t:+2. From Tiago Cunha.
Diffstat (limited to 'window.c')
-rw-r--r--window.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/window.c b/window.c
index 9e6a3500..d02178c1 100644
--- a/window.c
+++ b/window.c
@@ -1,4 +1,4 @@
-/* $Id: window.c,v 1.132 2010-05-22 21:56:04 micahcowan Exp $ */
+/* $Id: window.c,v 1.133 2010-06-22 23:29:05 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -170,6 +170,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)
{