Clean up image support and add regression tests

This commit is contained in:
Michael Grant
2026-10-04 11:44:00 +01:00
parent 91441d6ef2
commit 90ee6a89cc
31 changed files with 465 additions and 633 deletions

7
grid.c
View File

@@ -739,7 +739,7 @@ grid_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny, u_int bg)
if (nx == 0 || ny == 0)
return;
#ifdef ENABLE_IMAGES
image_grid_damage(gd, px, py, nx, ny);
image_grid_remove_sixel_spans(gd, px, py, nx, ny);
#endif
if (px == 0 && nx == gd->sx) {
@@ -793,7 +793,9 @@ grid_clear_lines(struct grid *gd, u_int py, u_int ny, u_int bg)
for (yy = py; yy < py + ny; yy++) {
gl = &gd->linedata[yy];
#ifdef ENABLE_IMAGES
image_grid_damage(gd, 0, yy, gd->sx, 1);
/* Remove any SIXEL spans invalidated by clearing this line. */
image_grid_remove_sixel_spans(gd, 0, yy, gd->sx, 1);
/* Preserve the remaining Kitty spans. */
images = gl->images;
#endif
free(gl->celldata);
@@ -1242,6 +1244,7 @@ grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx,
grid_get_cell(gd, xx, py, &gc);
if (gc.flags & GRID_FLAG_PADDING)
continue;
if (lastgc != NULL && (flags & GRID_STRING_WITH_SEQUENCES)) {
grid_string_cells_code(*lastgc, &gc, code, sizeof code,
flags, s, &has_link);