diff --git a/tmux.h b/tmux.h index 1691a26fa..54910a617 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1434 2026/09/08 08:33:10 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1435 2026/09/08 08:37:56 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -3700,6 +3700,7 @@ struct window_pane *window_pane_previous_by_number(struct window *, struct window_pane *, u_int); int window_pane_index(struct window_pane *, u_int *); int window_pane_zindex(struct window_pane *, u_int *); +int window_pane_last_index(struct window_pane *, u_int *); u_int window_count_panes(struct window *, int); void window_destroy_panes(struct window *); struct window_pane *window_pane_find_by_id_str(const char *); diff --git a/window.c b/window.c index 9feb1e71c..cbe65c615 100644 --- a/window.c +++ b/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.373 2026/08/24 21:17:19 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.374 2026/09/08 08:37:56 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1248,6 +1248,21 @@ window_pane_zindex(struct window_pane *wp, u_int *i) return (-1); } +int +window_pane_last_index(struct window_pane *wp, u_int *i) +{ + struct window *w = wp->window; + struct window_pane *wq; + + *i = 0; + TAILQ_FOREACH(wq, &w->last_panes, sentry) { + if (wq == wp) + return (0); + (*i)++; + } + return (-1); +} + u_int window_count_panes(struct window *w, int with_floating) {