Change tty_draw_pane to draw in the right place I think.

This commit is contained in:
Nicholas Marriott
2026-05-28 09:39:44 +01:00
parent 68e9ff797c
commit 3f77cb95c5

80
tty.c
View File

@@ -1093,7 +1093,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;
@@ -1128,6 +1128,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;
@@ -1391,63 +1402,32 @@ static void
tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py) tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py)
{ {
struct screen *s = ctx->s; struct screen *s = ctx->s;
struct window_pane *wp = ctx->arg; u_int nx = ctx->sx, i, x, rx, ry, j;
struct visible_ranges *r = NULL; struct visible_ranges *r;
struct visible_range *ri; struct visible_range *rr;
u_int nx = ctx->sx, i, px, x, rx, ry;
log_debug("%s: %s %u", __func__, tty->client->name, py); log_debug("%s: %s %u", __func__, tty->client->name, py);
if (~ctx->flags & TTY_CTX_WINDOW_BIGGER) { if (~ctx->flags & TTY_CTX_WINDOW_BIGGER) {
if (wp) { r = tty_check_overlay_range(tty, ctx->xoff, ctx->yoff + py, nx);
if (ctx->flags & TTY_CTX_PANE_OBSCURED) { for (j = 0; j < r->used; j++) {
/* rr = &r->ranges[j];
* Floating pane is present: use physical if (rr->nx == 0)
* coordinates and clip to visible ranges to continue;
* avoid drawing over the floating pane. tty_draw_line(tty, s, rr->px, py, rr->nx,
*/ ctx->xoff + rr->px, ctx->yoff + py, &ctx->defaults,
r = tty_check_overlay_range(tty, ctx->xoff, ctx->palette);
ctx->yoff + py, nx);
for (i = 0; i < r->used; i++) {
ri = &r->ranges[i];
if (ri->nx == 0) continue;
tty_draw_line(tty, s,
ri->px - ctx->xoff, py, ri->nx,
ri->px, ctx->yoff + py,
&ctx->defaults, ctx->palette);
}
} else {
r = tty_check_overlay_range(tty, 0,
ctx->yoff + py, nx);
for (i = 0; i < r->used; i++) {
ri = &r->ranges[i];
if (ri->nx == 0) continue;
tty_draw_line(tty, s, ri->px, py,
ri->nx, ctx->xoff + ri->px,
ctx->yoff + py,
&ctx->defaults, ctx->palette);
}
}
} else {
tty_draw_line(tty, s, 0, py, nx, ctx->xoff,
ctx->yoff + py, &ctx->defaults, ctx->palette);
} }
return; return;
} }
if (tty_clamp_line(tty, ctx, 0, py, nx, &px, &x, &rx, &ry)) { if (tty_clamp_line(tty, ctx, 0, py, nx, &i, &x, &rx, &ry)) {
if (wp) { r = tty_check_overlay_range(tty, x, ry, rx);
r = tty_check_overlay_range(tty, px, py, rx); for (j = 0; j < r->used; j++) {
for (i=0; i < r->used; i++) { rr = &r->ranges[j];
ri = &r->ranges[i]; if (rr->nx == 0)
if (ri->nx == 0)
continue; continue;
tty_draw_line(tty, s, ri->px, py, ri->nx, tty_draw_line(tty, s, i + rr->px, py, rr->nx,
x + ri->px, ry, &ctx->defaults, x + rr->px, ry, &ctx->defaults, ctx->palette);
ctx->palette);
}
} else {
tty_draw_line(tty, s, px, py, rx, x, ry, &ctx->defaults,
ctx->palette);
} }
} }
} }