From 6344bab6ccdc05c8af7506df398af5e11ac85e79 Mon Sep 17 00:00:00 2001 From: Michael Grant Date: Mon, 27 Oct 2025 19:54:21 +0000 Subject: [PATCH] Fix typo with visible_ranges struct name. Add support for checking visual ranges to tty_draw_pane. --- tty.c | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/tty.c b/tty.c index 07b89334..4ad746ce 100644 --- a/tty.c +++ b/tty.c @@ -1373,22 +1373,40 @@ tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py) { struct screen *s = ctx->s; struct window_pane *wp = ctx->arg; - struct visible_range *vr = NULL; - u_int nx = ctx->sx, i, x, rx, ry; + struct visible_ranges *vr = NULL; + u_int nx = ctx->sx, i, x, rx, ry, r; log_debug("%s: %s %u %d", __func__, tty->client->name, py, ctx->bigger); - if (wp) - vr = screen_redraw_get_visible_ranges(wp, 0, py, nx); - if (!ctx->bigger) { - tty_draw_line(tty, s, 0, py, nx, ctx->xoff, ctx->yoff + py, - &ctx->defaults, ctx->palette, vr); + if (wp) { + vr = screen_redraw_get_visible_ranges(wp, 0, py, nx); + for (r=0; r < vr->used; r++) { + if (vr->nx[r] == 0) + continue; + tty_draw_line(tty, s, vr->px[r], py, vr->nx[r], + ctx->xoff + vr->px[r], ctx->yoff + py, + &ctx->defaults, ctx->palette, vr); + } + } else { + tty_draw_line(tty, s, 0, py, nx, ctx->xoff, ctx->yoff + py, + &ctx->defaults, ctx->palette, vr); + } return; } if (tty_clamp_line(tty, ctx, 0, py, nx, &i, &x, &rx, &ry)) { - tty_draw_line(tty, s, i, py, rx, x, ry, &ctx->defaults, - ctx->palette, vr); + if (wp) { + vr = screen_redraw_get_visible_ranges(wp, i, py, rx); + for (r=0; r < vr->used; r++) { + if (vr->nx[r] == 0) + continue; + tty_draw_line(tty, s, i, py, vr->nx[r], x + vr->px[r], ry, &ctx->defaults, + ctx->palette, vr); + } + } else { + tty_draw_line(tty, s, i, py, rx, x, ry, &ctx->defaults, + ctx->palette, vr); + } } } @@ -1468,7 +1486,7 @@ tty_check_overlay_range(struct tty *tty, u_int px, u_int py, u_int nx, void tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx, u_int atx, u_int aty, const struct grid_cell *defaults, - struct colour_palette *palette, struct visible_range *vr) + struct colour_palette *palette, struct visible_ranges *vr) { struct grid *gd = s->grid; struct grid_cell gc, last; @@ -2216,7 +2234,7 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx) struct screen *s = ctx->s; struct overlay_ranges r; struct window_pane *wp = ctx->arg; - struct visible_range *vr; + struct visible_ranges *vr; u_int px, py, i, vis = 0; px = ctx->xoff + ctx->ocx - ctx->wox;