Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-05-31 22:30:06 +01:00

View File

@@ -242,6 +242,34 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
return (SCREEN_REDRAW_OUTSIDE);
}
/* Check a single cell position. */
static int
screen_redraw_cell_border1(struct screen_redraw_ctx *ctx, int sb_pos, int sb_w,
struct window_pane *wp, int px, int py)
{
if (sb_pos == PANE_SCROLLBARS_LEFT) {
if ((px < wp->xoff - 1 - sb_w ||
px > wp->xoff + (int)wp->sx) &&
(py < wp->yoff - 1 ||
py > wp->yoff + (int)wp->sy))
return (-1);
} else { /* PANE_SCROLLBARS_RIGHT or off. */
if ((px < wp->xoff - 1 ||
px > wp->xoff + (int)wp->sx + sb_w) &&
(py < wp->yoff - 1 ||
py > wp->yoff + (int)wp->sy))
return (-1);
}
switch (screen_redraw_pane_border(ctx, wp, px, py)) {
case SCREEN_REDRAW_INSIDE:
return (0);
case SCREEN_REDRAW_OUTSIDE:
return (-1);
default:
return (1);
}
}
/* Check if a cell is on a border. */
static int
screen_redraw_cell_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
@@ -250,7 +278,7 @@ screen_redraw_cell_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
struct client *c = ctx->c;
struct window *w = c->session->curw->window;
struct window_pane *wp2;
int sx = w->sx, sy = w->sy, sb_w, sb_pos, floating;
int sx = w->sx, sy = w->sy, sb_w, sb_pos, n;
if (ctx->pane_scrollbars != 0)
sb_pos = ctx->pane_scrollbars_pos;
@@ -258,57 +286,34 @@ screen_redraw_cell_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
sb_pos = 0;
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
/* For floating panes, only check the pane itself. */
if (wp->flags & PANE_FLOATING) {
n = screen_redraw_cell_border1(ctx, sb_pos, sb_w, wp, px, py);
if (n == -1)
return (0);
return (n);
}
/* Outside the window or on the window border? */
if (ctx->pane_status == PANE_STATUS_BOTTOM)
sy--;
floating = (wp->flags & PANE_FLOATING);
if (!floating) {
/* Outside the window? */
if (px > sx || py > sy)
return (0);
/* On the window border? */
if (px == sx || py == sy)
return (1);
}
if (px > sx || py > sy)
return (0);
if (px == sx || py == sy)
return (1);
/*
* If checking a cell from a tiled pane, ignore floating panes because
* tqo side-by-side or top-bottom panes share a border which is used to
* two side-by-side or top-bottom panes share a border which is used to
* do split colouring. Essentially, treat all tiled panes as being in a
* single z-index.
*
* If checking a cell from a floating pane, only check cells from this
* floating pane, again, essentially only this z-index.
*/
/* Check all the panes. */
TAILQ_FOREACH(wp2, &w->z_index, zentry) {
if (!window_pane_visible(wp2) ||
(!floating && (wp2->flags & PANE_FLOATING)) ||
(floating && wp2 != wp))
if (!window_pane_visible(wp2) || wp2->flags & PANE_FLOATING)
continue;
if (sb_pos == PANE_SCROLLBARS_LEFT) {
if ((px < wp2->xoff - 1 - sb_w ||
px > wp2->xoff + (int)wp2->sx) &&
(py < wp2->yoff - 1 ||
py > wp2->yoff + (int)wp2->sy))
continue;
} else { /* PANE_SCROLLBARS_RIGHT or off. */
if ((px < wp2->xoff - 1 ||
px > wp2->xoff + (int)wp2->sx + sb_w) &&
(py < wp2->yoff - 1 ||
py > wp2->yoff + (int)wp2->sy))
continue;
}
switch (screen_redraw_pane_border(ctx, wp2, px, py)) {
case SCREEN_REDRAW_INSIDE:
return (0);
case SCREEN_REDRAW_OUTSIDE:
break;
default:
return (1);
}
n = screen_redraw_cell_border1(ctx, sb_pos, sb_w, wp2, px, py);
if (n != -1)
return (n);
}
return (0);
@@ -440,7 +445,7 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py,
if (px > sx || py > sy)
return (CELL_OUTSIDE);
/* Find pane higest in z-index at this point. */
/* Find pane highest in z-index at this point. */
TAILQ_FOREACH(wp, &w->z_index, zentry) {
if (wp->flags & PANE_FLOATING && (px >= sx || py >= sy)) {
/* Clip floating panes to window. */
@@ -479,9 +484,10 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py,
*/
if (~wp->flags & PANE_FLOATING)
tiled_only = 1;
do { /* Loop until back to wp == start.*/
if (!window_pane_visible(wp) ||
(tiled_only && (wp->flags & PANE_FLOATING)))
do { /* loop until back to wp == start */
if (!window_pane_visible(wp))
goto next;
if (tiled_only && (wp->flags & PANE_FLOATING))
goto next;
*wpp = wp;
@@ -492,7 +498,7 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py,
(py < wp->yoff - 1 ||
py > wp->yoff + (int)wp->sy))
goto next;
} else { /* PANE_SCROLLBARS_RIGHT or none. */
} else { /* PANE_SCROLLBARS_RIGHT or none */
if ((px < wp->xoff - 1 ||
px > wp->xoff + (int)wp->sx + sb_w) &&
(py < wp->yoff - 1 ||
@@ -568,7 +574,7 @@ screen_redraw_check_is(struct screen_redraw_ctx *ctx, int px, int py,
enum screen_redraw_border_type border;
if (wp == NULL)
return (0); /* No active pane. */
return (0); /* no active pane */
border = screen_redraw_pane_border(ctx, wp, px, py);
if (border != SCREEN_REDRAW_INSIDE && border != SCREEN_REDRAW_OUTSIDE)
return (1);
@@ -914,6 +920,13 @@ screen_redraw_draw_border_arrows(struct screen_redraw_ctx *ctx, int i,
if (i != wp->xoff + 1 && j != wp->yoff + 1)
return;
if (wp != active) {
if (active->flags & PANE_FLOATING)
return;
if (wp->flags & PANE_FLOATING)
return;
}
value = options_get_number(oo, "pane-border-indicators");
if (value != PANE_BORDER_ARROWS && value != PANE_BORDER_BOTH)
return;