Add a helper to get pane-border-status for a window for some other

changes to come.
This commit is contained in:
nicm
2026-06-14 19:31:37 +00:00
parent 778a15b64a
commit 87976aa48e
7 changed files with 34 additions and 29 deletions

View File

@@ -627,7 +627,7 @@ window_get_active_at(struct window *w, u_int x, u_int y)
int pane_status, xoff, yoff;
u_int sx, sy;
pane_status = options_get_number(w->options, "pane-border-status");
pane_status = window_get_pane_status(w);
if (pane_status == PANE_STATUS_TOP) {
/*
@@ -635,10 +635,12 @@ window_get_active_at(struct window *w, u_int x, u_int y)
* bottom border.
*/
TAILQ_FOREACH(wp, &w->z_index, zentry) {
if (!window_pane_visible(wp) || window_pane_is_floating(wp))
if (!window_pane_visible(wp) ||
window_pane_is_floating(wp))
continue;
window_pane_full_size_offset(wp, &xoff, &yoff, &sx, &sy);
window_pane_full_size_offset(wp, &xoff, &yoff, &sx,
&sy);
if ((int)x < xoff || x > xoff + sx)
continue;
if ((int)y == yoff - 1)
@@ -685,7 +687,7 @@ window_find_string(struct window *w, const char *s)
x = w->sx / 2;
y = w->sy / 2;
status = options_get_number(w->options, "pane-border-status");
status = window_get_pane_status(w);
if (status == PANE_STATUS_TOP)
top++;
else if (status == PANE_STATUS_BOTTOM)
@@ -1544,7 +1546,7 @@ window_pane_find_up(struct window_pane *wp)
if (wp == NULL)
return (NULL);
w = wp->window;
status = options_get_number(w->options, "pane-border-status");
status = window_get_pane_status(w);
list = NULL;
size = 0;
@@ -1605,7 +1607,7 @@ window_pane_find_down(struct window_pane *wp)
if (wp == NULL)
return (NULL);
w = wp->window;
status = options_get_number(w->options, "pane-border-status");
status = window_get_pane_status(w);
list = NULL;
size = 0;
@@ -2121,21 +2123,19 @@ window_pane_send_theme_update(struct window_pane *wp)
}
struct style_range *
window_pane_border_status_get_range(struct window_pane *wp, u_int x, u_int y)
window_pane_status_get_range(struct window_pane *wp, u_int x, u_int y)
{
struct style_ranges *srs;
struct window *w;
struct options *wo;
u_int line;
int pane_status;
if (wp == NULL)
return (NULL);
w = wp->window;
wo = w->options;
srs = &wp->border_status_line.ranges;
pane_status = options_get_number(wo, "pane-border-status");
pane_status = window_get_pane_status(w);
if (pane_status == PANE_STATUS_TOP)
line = wp->yoff - 1;
else if (pane_status == PANE_STATUS_BOTTOM)
@@ -2150,6 +2150,12 @@ window_pane_border_status_get_range(struct window_pane *wp, u_int x, u_int y)
return (style_ranges_get_range(srs, x - wp->xoff - 2));
}
int
window_get_pane_status(struct window *w)
{
return (options_get_number(w->options, "pane-border-status"));
}
int
window_pane_is_floating(struct window_pane *wp)
{