diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2010-06-21 01:46:36 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2010-06-21 01:46:36 +0000 |
commit | 386849edc1d7d322d6a48d334f83298ff7cb5501 (patch) | |
tree | 2c0daf4ce5703466ef3f53333fd87e2a689dc33b /window.c | |
parent | e63f0546a166c442464c7d8500a74b38c036432a (diff) | |
download | rtmux-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.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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) { |