config: default search keybindings for macos

pull/9709/head
Mitchell Hashimoto 2025-11-25 20:29:54 -08:00
parent 3f7cfca4b4
commit 240d5e0fc5
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
2 changed files with 27 additions and 1 deletions

View File

@ -4896,7 +4896,15 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
const s: *Search = if (self.search) |*s| s else init: {
// If we're stopping the search and we had no prior search,
// then there is nothing to do.
if (text.len == 0) return false;
if (text.len == 0) {
// So GUIs can hide visible search widgets.
_ = try self.rt_app.performAction(
.{ .surface = self },
.end_search,
{},
);
return false;
}
// We need to assign directly to self.search because we need
// a stable pointer back to the thread state.

View File

@ -6410,12 +6410,30 @@ pub const Keybinds = struct {
.start_search,
.{ .performable = true },
);
try self.set.putFlags(
alloc,
.{ .key = .{ .unicode = 'f' }, .mods = .{ .super = true, .shift = true } },
.{ .search = "" },
.{ .performable = true },
);
try self.set.putFlags(
alloc,
.{ .key = .{ .physical = .escape } },
.{ .search = "" },
.{ .performable = true },
);
try self.set.putFlags(
alloc,
.{ .key = .{ .unicode = 'g' }, .mods = .{ .super = true } },
.{ .navigate_search = .next },
.{ .performable = true },
);
try self.set.putFlags(
alloc,
.{ .key = .{ .unicode = 'g' }, .mods = .{ .super = true, .shift = true } },
.{ .navigate_search = .previous },
.{ .performable = true },
);
// Inspector, matching Chromium
try self.set.put(