Bugfix visible_ranges calculation, no longer need to inject vr into tty_draw_line.

This commit is contained in:
Michael Grant
2025-10-28 12:50:13 +00:00
parent 7980d00e8c
commit 39d2839e37
5 changed files with 18 additions and 19 deletions

2
menu.c
View File

@@ -217,7 +217,7 @@ menu_draw_cb(struct client *c, void *data,
for (i = 0; i < screen_size_y(&md->s); i++) {
tty_draw_line(tty, s, 0, i, menu->width + 4, px, py + i,
&grid_default_cell, NULL, NULL);
&grid_default_cell, NULL);
}
}

View File

@@ -250,7 +250,7 @@ popup_draw_cb(struct client *c, void *data, struct screen_redraw_ctx *rctx)
}
for (i = 0; i < pd->sy; i++) {
tty_draw_line(tty, &s, 0, i, pd->sx, px, py + i, &defaults,
palette, NULL);
palette);
}
screen_free(&s);
if (pd->md != NULL) {

View File

@@ -595,7 +595,7 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
if (vr->nx[r] == 0)
continue;
tty_draw_line(tty, s, i + (vr->px[r] - x), 0, vr->nx[r], vr->px[r], yoff - ctx->oy,
&grid_default_cell, NULL, vr);
&grid_default_cell, NULL);
}
}
tty_cursor(tty, 0, 0);
@@ -915,7 +915,7 @@ screen_redraw_draw_status(struct screen_redraw_ctx *ctx)
y = c->tty.sy - ctx->statuslines;
for (i = 0; i < ctx->statuslines; i++) {
tty_draw_line(tty, s, 0, i, UINT_MAX, 0, y + i,
&grid_default_cell, NULL, NULL);
&grid_default_cell, NULL);
}
}
@@ -990,7 +990,7 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
for (r=0; r < vr.used; r++) {
lb = wp->xoff - 1;
rb = wp->xoff + wp->sx + sb_w + 1;
rb = wp->xoff + wp->sx + sb_w;
/* If the left edge of floating wp
falls inside this range and right
edge covers up to right of range,
@@ -1028,6 +1028,7 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
vr.used++;
vr.nx[r] = lb;
vr.px[r+1] = rb;
vr.nx[r+1] = vr.nx[r+1] - rb - 1;
}
/* If floating wp completely covers this range
then delete it (make it 0 length). */
@@ -1108,8 +1109,7 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
pane offset. If you don't sub offset,
contents of pane shifted. */
tty_draw_line(tty, s, i + vr->px[r] - wp->xoff, j,
vr->nx[r], vr->px[r], y, &defaults, palette,
vr);
vr->nx[r], vr->px[r], y, &defaults, palette);
}
}

3
tmux.h
View File

@@ -2532,8 +2532,7 @@ void tty_set_title(struct tty *, const char *);
void tty_set_path(struct tty *, const char *);
void tty_update_mode(struct tty *, int, struct screen *);
void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int,
u_int, u_int, const struct grid_cell *, struct colour_palette *,
struct visible_ranges *);
u_int, u_int, const struct grid_cell *, struct colour_palette *);
#ifdef ENABLE_SIXEL
void tty_draw_images(struct client *, struct window_pane *, struct screen *);

20
tty.c
View File

@@ -1385,12 +1385,12 @@ tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py)
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);
ctx->xoff + vr->px[r], 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, vr);
tty_draw_line(tty, s, 0, py, nx, ctx->xoff,
ctx->yoff + py, &ctx->defaults, ctx->palette);
}
return;
}
@@ -1400,12 +1400,13 @@ tty_draw_pane(struct tty *tty, const struct tty_ctx *ctx, u_int py)
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);
tty_draw_line(tty, s, i, py, vr->nx[r],
x + vr->px[r], ry, &ctx->defaults,
ctx->palette);
}
} else {
tty_draw_line(tty, s, i, py, rx, x, ry, &ctx->defaults,
ctx->palette, vr);
ctx->palette);
}
}
}
@@ -1486,7 +1487,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_ranges *vr)
struct colour_palette *palette)
{
struct grid *gd = s->grid;
struct grid_cell gc, last;
@@ -1573,7 +1574,6 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
gcp = tty_check_codeset(tty, &gc);
if (len != 0 &&
(!tty_check_overlay(tty, atx + ux + width, aty) ||
screen_redraw_is_visible(vr, atx + ux + width) ||
(gcp->attr & GRID_ATTR_CHARSET) ||
gcp->flags != last.flags ||
gcp->attr != last.attr ||
@@ -2255,7 +2255,7 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
if (vis < gcp->data.width ||
vis2 < gcp->data.width) {
tty_draw_line(tty, s, s->cx, s->cy, gcp->data.width,
px, py, &ctx->defaults, ctx->palette, vr);
px, py, &ctx->defaults, ctx->palette);
return;
}
}