diff --git a/src/pane.zig b/src/pane.zig index 98226e4..0a2e18b 100644 --- a/src/pane.zig +++ b/src/pane.zig @@ -29,6 +29,10 @@ fn exit_signal(_: i32) callconv(.C) void { should_exit.store(true, .release); } +fn panic_signal(_: i32) callconv(.C) void { + @panic("Segmentation fault!!"); +} + pub fn set_layout(layout: *Pane, initial_focus: *Pane) void { layout.parent = &window.pane; window.child = layout; @@ -51,6 +55,13 @@ pub fn init(term_io: *TermIO) !void { }; try std.posix.sigaction(std.posix.SIG.INT, &exit_handler, null); + var panic_handler = std.posix.Sigaction{ + .handler = .{ .handler = panic_signal }, + .mask = std.posix.empty_sigset, + .flags = 0, + }; + try std.posix.sigaction(std.posix.SIG.SEGV, &panic_handler, null); + term_io.enterRawMode(); term_io.saveScreen(); term_io.hideCursor();