aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-05-08 13:18:25 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-05-08 18:27:20 +0000
commitbfd3eb47ec164b289c0da812817629236acdc43d (patch)
tree9d8d717a5a884a3d5094555e4c00d0b334bd3057 /terminal.c
parentterm: osc8-open: assert URI in VT struct is NULL (diff)
term: reset: fix reset of the VT struct
1. Free buffers and strings 2. memset() the vt struct 3. re-initialize members that must not be zero We _could_ replace the memset() with explicit zeroing of all the members. It’s just that there’s a lot of arrays, so this is much easier. Closes #495
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/terminal.c b/terminal.c
index 6ec37406..9704b891 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1649,13 +1649,12 @@ term_reset(struct terminal *term, bool hard)
term->scroll_region.start = 0;
term->scroll_region.end = term->rows;
+ free(term->vt.osc8.uri);
free(term->vt.osc.data);
- memset(&term->vt, 0, sizeof(term->vt));
- term->vt.state = 0; /* GROUND */
+ memset(&term->vt, 0, sizeof(term->vt));
+ term->vt.state = 0; /* STATE_GROUND */
term->vt.osc8.begin = (struct coord){-1, -1};
- free(term->vt.osc8.uri);
- term->vt.osc8.uri = NULL;
if (term->grid == &term->alt) {
term->grid = &term->normal;