From a1b43d24653670d612b91f0855b165e6c987b809 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Mon, 30 Sep 2024 10:52:30 -0500 Subject: [PATCH] core: reset sgr on deinit, and at the end of prettyPrint Reset SGR unilaterally when deiniting vaxis. Also reset it at the end of a prettyPrint render. --- src/Vaxis.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Vaxis.zig b/src/Vaxis.zig index ae0f841..51416a4 100644 --- a/src/Vaxis.zig +++ b/src/Vaxis.zig @@ -114,6 +114,7 @@ pub fn deinit(self: *Vaxis, alloc: ?std.mem.Allocator, tty: AnyWriter) void { // always show the cursor on exit tty.writeAll(ctlseqs.show_cursor) catch {}; + tty.writeAll(ctlseqs.sgr_reset) catch {}; if (self.screen.cursor_shape != .default) { // In many terminals, `.default` will set to the configured cursor shape. Others, it will // change to a blinking block. @@ -974,6 +975,7 @@ pub fn prettyPrint(self: *Vaxis, tty: AnyWriter) !void { try tty.writeAll(ctlseqs.sync_set); defer tty.writeAll(ctlseqs.sync_reset) catch {}; try tty.writeAll(ctlseqs.sgr_reset); + defer tty.writeAll(ctlseqs.sgr_reset) catch {}; var reposition: bool = false; var row: usize = 0;