this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

core: reset cursor and sgr in resetState

Move code to reset cursor and sgr state into `resetState` from `deinit`.

Fixes: #98

+8 -8
+8 -8
src/Vaxis.zig
··· 108 108 pub fn deinit(self: *Vaxis, alloc: ?std.mem.Allocator, tty: AnyWriter) void { 109 109 self.resetState(tty) catch {}; 110 110 111 - // always show the cursor on exit 112 - tty.writeAll(ctlseqs.show_cursor) catch {}; 113 - tty.writeAll(ctlseqs.sgr_reset) catch {}; 114 - if (self.screen.cursor_shape != .default) { 115 - // In many terminals, `.default` will set to the configured cursor shape. Others, it will 116 - // change to a blinking block. 117 - tty.print(ctlseqs.cursor_shape, .{@intFromEnum(Cell.CursorShape.default)}) catch {}; 118 - } 119 111 if (alloc) |a| { 120 112 self.screen.deinit(a); 121 113 self.screen_last.deinit(a); ··· 125 117 126 118 /// resets enabled features, sends cursor to home and clears below cursor 127 119 pub fn resetState(self: *Vaxis, tty: AnyWriter) !void { 120 + // always show the cursor on state reset 121 + tty.writeAll(ctlseqs.show_cursor) catch {}; 122 + tty.writeAll(ctlseqs.sgr_reset) catch {}; 123 + if (self.screen.cursor_shape != .default) { 124 + // In many terminals, `.default` will set to the configured cursor shape. Others, it will 125 + // change to a blinking block. 126 + tty.print(ctlseqs.cursor_shape, .{@intFromEnum(Cell.CursorShape.default)}) catch {}; 127 + } 128 128 if (self.state.kitty_keyboard) { 129 129 try tty.writeAll(ctlseqs.csi_u_pop); 130 130 self.state.kitty_keyboard = false;