Use the correct ranges when a pane is covered by a popup in tty_draw_pane.

This commit is contained in:
nicm
2026-05-28 08:43:57 +00:00
parent 9c6cfcd2e9
commit c50c3629e6

32
tty.c
View File

@@ -1088,7 +1088,7 @@ tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx)
* If region is large, schedule a redraw. In most cases this is likely * If region is large, schedule a redraw. In most cases this is likely
* to be followed by some more scrolling. * to be followed by some more scrolling.
*/ */
if (tty_large_region(tty, ctx) && ~ctx->flags & TTY_CTX_PANE_OBSCURED) { if (tty_large_region(tty, ctx) || ctx->flags & TTY_CTX_PANE_OBSCURED) {
log_debug("%s: %s large region redraw", __func__, c->name); log_debug("%s: %s large region redraw", __func__, c->name);
ctx->redraw_cb(ctx); ctx->redraw_cb(ctx);
return; return;
@@ -1123,6 +1123,17 @@ tty_clamp_line(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py,
{ {
int xoff = ctx->rxoff + px; int xoff = ctx->rxoff + px;
/*
* px = x position in pane
* py = y position in pane
* nx = width
*
* i = new x position in pane
* x = x position on terminal
* rx = new width
* ry = y position on terminal
*/
if (!tty_is_visible(tty, ctx, px, py, nx, 1)) if (!tty_is_visible(tty, ctx, px, py, nx, 1))
return (0); return (0);
*ry = ctx->yoff + py - ctx->woy; *ry = ctx->yoff + py - ctx->woy;
@@ -1396,11 +1407,11 @@ tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py)
r = tty_check_overlay_range(tty, ctx->xoff, ctx->yoff + py, nx); r = tty_check_overlay_range(tty, ctx->xoff, ctx->yoff + py, nx);
for (j = 0; j < r->used; j++) { for (j = 0; j < r->used; j++) {
rr = &r->ranges[j]; rr = &r->ranges[j];
if (rr->nx != 0) { if (rr->nx == 0)
tty_draw_line(tty, s, rr->px - ctx->xoff, py, continue;
rr->nx, rr->px, ctx->yoff + py, tty_draw_line(tty, s, rr->px, py, rr->nx,
&ctx->defaults, ctx->palette); ctx->xoff + rr->px, ctx->yoff + py, &ctx->defaults,
} ctx->palette);
} }
return; return;
} }
@@ -1408,11 +1419,10 @@ tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py)
r = tty_check_overlay_range(tty, x, ry, rx); r = tty_check_overlay_range(tty, x, ry, rx);
for (j = 0; j < r->used; j++) { for (j = 0; j < r->used; j++) {
rr = &r->ranges[j]; rr = &r->ranges[j];
if (rr->nx != 0) { if (rr->nx == 0)
tty_draw_line(tty, s, i + (rr->px - x), py, continue;
rr->nx, rr->px, ry, &ctx->defaults, tty_draw_line(tty, s, i + rr->px, py, rr->nx,
ctx->palette); x + rr->px, ry, &ctx->defaults, ctx->palette);
}
} }
} }
} }