term: reset: use grid_row_alloc() with initialize=true

This will both zero out the cells, *and* re-initialize the row
properties correctly.
This commit is contained in:
Daniel Eklöf 2020-02-14 22:43:23 +01:00
parent ce8005545d
commit d11a71e0b2
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -1090,8 +1090,8 @@ term_reset(struct terminal *term, bool hard)
term->normal.offset = term->normal.view = 0;
term->alt.offset = term->alt.view = 0;
for (size_t i = 0; i < term->rows; i++) {
memset(grid_row_and_alloc(&term->normal, i)->cells, 0, term->cols * sizeof(struct cell));
memset(grid_row_and_alloc(&term->alt, i)->cells, 0, term->cols * sizeof(struct cell));
term->normal.rows[i] = grid_row_alloc(term->cols, true);
term->alt.rows[i] = grid_row_alloc(term->cols, true);
}
for (size_t i = term->rows; i < term->normal.num_rows; i++) {
grid_row_free(term->normal.rows[i]);