This commit is contained in:
Michael Grant
2026-04-05 19:40:56 -04:00
35 changed files with 1256 additions and 1654 deletions

View File

@@ -653,10 +653,10 @@ struct window_pane *
window_get_active_at(struct window *w, u_int x, u_int y)
{
struct window_pane *wp;
int status, xoff, yoff;
int pane_status, xoff, yoff;
u_int sx, sy;
status = options_get_number(w->options, "pane-border-status");
pane_status = options_get_number(w->options, "pane-border-status");
TAILQ_FOREACH(wp, &w->z_index, zentry) {
if (!window_pane_visible(wp))
@@ -667,7 +667,7 @@ window_get_active_at(struct window *w, u_int x, u_int y)
right border. */
if ((int)x < xoff || x > xoff + sx)
continue;
if (status == PANE_STATUS_TOP) {
if (pane_status == PANE_STATUS_TOP) {
if ((int)y < yoff - 1 || y > yoff + sy)
continue;
} else {
@@ -678,8 +678,13 @@ window_get_active_at(struct window *w, u_int x, u_int y)
/* Floating, include top or or left border. */
if ((int)x < xoff - 1 || x > xoff + sx)
continue;
if ((int)y < yoff - 1 || y > yoff + sy)
if (pane_status == PANE_STATUS_TOP) {
if ((int)y <= yoff - 2 || y > yoff + sy - 1)
continue;
} else {
if ((int)y < yoff - 1 || y > yoff + sy)
continue;
}
}
return (wp);
}
@@ -990,9 +995,8 @@ window_printable_flags(struct winlink *wl, int escape)
{
struct session *s = wl->session;
static char flags[32];
int pos;
u_int pos = 0;
pos = 0;
if (wl->flags & WINLINK_ACTIVITY) {
flags[pos++] = '#';
if (escape)
@@ -1015,7 +1019,7 @@ window_printable_flags(struct winlink *wl, int escape)
}
const char *
window_pane_printable_flags(struct window_pane *wp, __unused int escape)
window_pane_printable_flags(struct window_pane *wp)
{
static char flags[32];
struct window *w = wp->window;
@@ -1099,6 +1103,7 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
window_pane_default_cursor(wp);
screen_init(&wp->status_screen, 1, 1, 0);
style_ranges_init(&wp->border_status_line.ranges);
if (gethostname(host, sizeof host) == 0)
screen_set_title(&wp->base, host);
@@ -1151,6 +1156,7 @@ window_pane_destroy(struct window_pane *wp)
free(wp->shell);
cmd_free_argv(wp->argc, wp->argv);
colour_palette_free(&wp->palette);
style_ranges_free(&wp->border_status_line.ranges);
free(wp);
}
@@ -2121,3 +2127,31 @@ window_pane_send_theme_update(struct window_pane *wp)
break;
}
}
struct style_range *
window_pane_border_status_get_range(struct window_pane *wp, u_int x, u_int y)
{
struct style_ranges *srs;
struct window *w = wp->window;
struct options *wo = w->options;
u_int line;
int pane_status;
if (wp == NULL)
return (NULL);
srs = &wp->border_status_line.ranges;
pane_status = options_get_number(wo, "pane-border-status");
if (pane_status == PANE_STATUS_TOP)
line = wp->yoff - 1;
else if (pane_status == PANE_STATUS_BOTTOM)
line = wp->yoff + wp->sy;
if (pane_status == PANE_STATUS_OFF || line != y)
return (NULL);
/*
* The border formats start 2 off but that isn't reflected in
* the stored bounds of the range.
*/
return (style_ranges_get_range(srs, x - wp->xoff - 2));
}