aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-06-21 01:46:36 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-06-21 01:46:36 +0000
commit386849edc1d7d322d6a48d334f83298ff7cb5501 (patch)
tree2c0daf4ce5703466ef3f53333fd87e2a689dc33b /window.c
parente63f0546a166c442464c7d8500a74b38c036432a (diff)
downloadrtmux-386849edc1d7d322d6a48d334f83298ff7cb5501.tar.gz
rtmux-386849edc1d7d322d6a48d334f83298ff7cb5501.tar.bz2
rtmux-386849edc1d7d322d6a48d334f83298ff7cb5501.zip
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.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)
{