csi: \E[3J: reset render.last_cursor.row if necessary

This fixes a crash that occurred when the last rendered cursor cell
had scrolled off screen, and \E[3J (clear scrollback) was executed.
This commit is contained in:
Daniel Eklöf 2020-06-09 17:32:34 +02:00
parent fb001ee7a7
commit bf57d0c606
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 5 additions and 0 deletions

View file

@ -55,6 +55,8 @@
* Glyphs overflowing into surrounding cells
(https://codeberg.org/dnkl/foot/issues/21).
* Sixel images being erased when printing text next to them.
* Crash when last rendered cursor cell had scrolled off screen and
`\E[J3` was executed.
### Security

3
csi.c
View file

@ -506,6 +506,9 @@ csi_dispatch(struct terminal *term, uint8_t final)
continue;
}
if (term->render.last_cursor.row == term->grid->rows[i])
term->render.last_cursor.row = NULL;
grid_row_free(term->grid->rows[i]);
term->grid->rows[i] = NULL;
}