mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
Merge pull request #733 from mitchellh/insp-crash
Fix inspector toggle crash, default keybinds to match Chromium
This commit is contained in:
@ -1014,8 +1014,15 @@ pub fn keyCallback(
|
||||
|
||||
// When we're done processing, we always want to add the event to
|
||||
// the inspector.
|
||||
defer if (insp_ev) |ev| {
|
||||
if (self.inspector.?.recordKeyEvent(ev)) {
|
||||
defer if (insp_ev) |ev| ev: {
|
||||
// We have to check for the inspector again because our keybinding
|
||||
// might close it.
|
||||
const insp = self.inspector orelse {
|
||||
ev.deinit(self.alloc);
|
||||
break :ev;
|
||||
};
|
||||
|
||||
if (insp.recordKeyEvent(ev)) {
|
||||
self.queueRender() catch {};
|
||||
} else |err| {
|
||||
log.warn("error adding key event to inspector err={}", .{err});
|
||||
|
@ -753,6 +753,13 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config {
|
||||
.{ .key = .page_down, .mods = .{ .shift = true, .ctrl = true } },
|
||||
.{ .jump_to_prompt = 1 },
|
||||
);
|
||||
|
||||
// Inspector, matching Chromium
|
||||
try result.keybind.set.put(
|
||||
alloc,
|
||||
.{ .key = .i, .mods = .{ .shift = true, .ctrl = true } },
|
||||
.{ .inspector = .toggle },
|
||||
);
|
||||
}
|
||||
{
|
||||
// Cmd+N for goto tab N
|
||||
@ -913,6 +920,13 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config {
|
||||
.{ .key = .right, .mods = .{ .super = true, .alt = true } },
|
||||
.{ .goto_split = .right },
|
||||
);
|
||||
|
||||
// Inspector, matching Chromium
|
||||
try result.keybind.set.put(
|
||||
alloc,
|
||||
.{ .key = .i, .mods = .{ .alt = true, .super = true } },
|
||||
.{ .inspector = .toggle },
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user