Extend the -t:+ and -t:- window targets for next and previous window to

accept an offset such as -t:+2. From Tiago Cunha.
This commit is contained in:
Nicholas Marriott
2010-06-21 01:46:36 +00:00
parent e63f0546a1
commit 386849edc1
4 changed files with 159 additions and 64 deletions

View File

@ -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)
{