More checks for macOS.

This commit is contained in:
Nicholas Marriott
2026-06-30 21:28:28 +01:00
parent 90fc51542f
commit 928c7a9771
3 changed files with 37 additions and 1 deletions

35
grid.c
View File

@@ -74,11 +74,45 @@ grid_check_lines(struct grid *gd)
} }
} }
} }
void
grid_check_is_clear(struct grid *gd)
{
struct grid_line *gl;
u_int yy, ny;
assert(gd != NULL);
if (gd->sy == 0) {
assert(gd->linedata == NULL);
return;
}
assert(gd->linedata != NULL);
ny = gd->hsize + gd->sy;
for (yy = 0; yy < ny; yy++) {
gl = &gd->linedata[yy];
assert(gl->celldata == NULL);
assert(gl->cellused == 0);
assert(gl->cellsize == 0);
assert(gl->extddata == NULL);
assert(gl->extdsize == 0);
assert(gl->flags == 0);
assert(gl->time == 0);
}
}
#else #else
static void static void
grid_check_lines(__unused struct grid *gd) grid_check_lines(__unused struct grid *gd)
{ {
} }
void
grid_check_is_clear(__unused struct grid *gd)
{
}
#endif #endif
/* Store cell in entry. */ /* Store cell in entry. */
@@ -363,6 +397,7 @@ grid_create(u_int sx, u_int sy, u_int hlimit)
else else
gd->linedata = NULL; gd->linedata = NULL;
grid_check_is_clear(gd);
return (gd); return (gd);
} }

View File

@@ -123,7 +123,7 @@ screen_reinit(struct screen *s)
s->saved_cy = UINT_MAX; s->saved_cy = UINT_MAX;
screen_reset_tabs(s); screen_reset_tabs(s);
grid_check_is_clear(s->grid);
grid_clear_lines(s->grid, s->grid->hsize, s->grid->sy, 8); grid_clear_lines(s->grid, s->grid->hsize, s->grid->sy, 8);
screen_clear_selection(s); screen_clear_selection(s);

1
tmux.h
View File

@@ -3323,6 +3323,7 @@ bitstr_t *fuzzy_match(const char *, const char *, u_int, u_int *);
/* grid.c */ /* grid.c */
extern const struct grid_cell grid_default_cell; extern const struct grid_cell grid_default_cell;
void grid_check_is_clear(struct grid *);
void grid_empty_line(struct grid *, u_int, u_int); void grid_empty_line(struct grid *, u_int, u_int);
void grid_set_tab(struct grid_cell *, u_int); void grid_set_tab(struct grid_cell *, u_int);
int grid_cells_equal(const struct grid_cell *, const struct grid_cell *); int grid_cells_equal(const struct grid_cell *, const struct grid_cell *);