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.
This commit is contained in:
Tiago Cunha
2010-06-22 23:29:05 +00:00
parent 47b335dee7
commit 8d3b726396
4 changed files with 164 additions and 69 deletions

View File

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