From 149e09f119a10aa188e54fb83968bedbc289abb2 Mon Sep 17 00:00:00 2001 From: Cameron Reed Date: Thu, 17 Oct 2024 11:39:00 -0600 Subject: [PATCH] Only register signal handlers after the first successful write to the screen --- src/pane.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pane.zig b/src/pane.zig index 0a2e18b..0329a8a 100644 --- a/src/pane.zig +++ b/src/pane.zig @@ -41,6 +41,11 @@ pub fn set_layout(layout: *Pane, initial_focus: *Pane) void { } pub fn init(term_io: *TermIO) !void { + term_io.enterRawMode(); + term_io.saveScreen(); + term_io.hideCursor(); + term_io.flush(); + var resize_handler = std.posix.Sigaction{ .handler = .{ .handler = resize_signal }, .mask = std.posix.empty_sigset, @@ -62,11 +67,6 @@ pub fn init(term_io: *TermIO) !void { }; try std.posix.sigaction(std.posix.SIG.SEGV, &panic_handler, null); - term_io.enterRawMode(); - term_io.saveScreen(); - term_io.hideCursor(); - term_io.flush(); - window.resize(term_io); try window.draw(term_io); }