From 49e56a90579b6ddce040916d657e593e5c5a33f0 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 31 Aug 2024 20:18:58 -0700 Subject: [PATCH] input: add crash binding action, remove key input crash --- src/Surface.zig | 4 ++-- src/input/Binding.zig | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Surface.zig b/src/Surface.zig index aa9ac17df..025b96573 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -1333,8 +1333,6 @@ pub fn keyCallback( self: *Surface, event: input.KeyEvent, ) !InputEffect { - // To test crash reporting - if (true) @panic("OH NO"); // log.debug("text keyCallback event={}", .{event}); // Setup our inspector event if we have an inspector. @@ -3675,6 +3673,8 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool .quit => try self.app.setQuit(), + .crash => @panic("crash binding action, crashing intentionally"), + .adjust_selection => |direction| { self.renderer_state.mutex.lock(); defer self.renderer_state.mutex.unlock(); diff --git a/src/input/Binding.zig b/src/input/Binding.zig index b129a9c56..d628b5dbe 100644 --- a/src/input/Binding.zig +++ b/src/input/Binding.zig @@ -300,6 +300,13 @@ pub const Action = union(enum) { /// Quit ghostty. quit: void, + /// Crash ghostty. This is funny, but is used for testing crash handling. + /// It is shipped in production builds because sometimes we need to + /// test crash handling works for a user who may have some specific + /// configuration. This is not bound by default and I recommend not + /// binding it. + crash: void, + pub const CursorKey = struct { normal: []const u8, application: []const u8,