aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-02-14 21:43:23 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-02-14 21:43:23 +0000
commitd11a71e0b221cc24404da37ea928708a03d65c47 (patch)
tree90dcba756a8ab74d9de7f7f32e001740ae69bb79
parentterm: convert cell 'linefeed' attribute to a row 'linebreak' property (diff)
term: reset: use grid_row_alloc() with initialize=true
This will both zero out the cells, *and* re-initialize the row properties correctly.
-rw-r--r--terminal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/terminal.c b/terminal.c
index b2fb9233..bec0ce7b 100644
--- a/terminal.c
+++ b/terminal.c
@@ -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]);