Make window_pane_index work the same as window_index, from Ben Boeckel.

This commit is contained in:
Nicholas Marriott
2011-11-15 23:19:51 +00:00
parent 9f738dd2fe
commit 57df442916
6 changed files with 25 additions and 15 deletions

View File

@ -486,19 +486,21 @@ window_pane_previous_by_number(struct window *w, struct window_pane *wp,
return (wp);
}
u_int
window_pane_index(struct window *w, struct window_pane *wp)
int
window_pane_index(struct window_pane *wp, u_int *i)
{
struct window_pane *wq;
u_int n;
struct window *w = wp->window;
n = options_get_number(&w->options, "pane-base-index");
*i = options_get_number(&w->options, "pane-base-index");
TAILQ_FOREACH(wq, &w->panes, entry) {
if (wp == wq)
break;
n++;
if (wp == wq) {
return (0);
}
(*i)++;
}
return (n);
return (-1);
}
u_int