diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2011-11-15 23:19:51 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2011-11-15 23:19:51 +0000 |
commit | 57df44291634e1083fccf29ecccc8b1793647e50 (patch) | |
tree | c93759746d1f177de3bb0cca0909c6aa984bb81b /window.c | |
parent | 9f738dd2fe01b5b70c07280450eed32614c561c2 (diff) | |
download | rtmux-57df44291634e1083fccf29ecccc8b1793647e50.tar.gz rtmux-57df44291634e1083fccf29ecccc8b1793647e50.tar.bz2 rtmux-57df44291634e1083fccf29ecccc8b1793647e50.zip |
Make window_pane_index work the same as window_index, from Ben Boeckel.
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -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 |