mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-15 15:58:20 +00:00
clean up bindings so that they match macOS menus
This commit is contained in:
@@ -1043,13 +1043,17 @@ extension Ghostty {
|
||||
}
|
||||
|
||||
// If this event as-is would result in a key binding then we send it.
|
||||
if let surface,
|
||||
ghostty_surface_key_is_binding(
|
||||
surface,
|
||||
event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS)) {
|
||||
if let surface {
|
||||
var ghosttyEvent = event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS)
|
||||
let match = (event.characters ?? "").withCString { ptr in
|
||||
ghosttyEvent.text = ptr
|
||||
return ghostty_surface_key_is_binding(surface, ghosttyEvent)
|
||||
}
|
||||
if match {
|
||||
self.keyDown(with: event)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
let equivalent: String
|
||||
switch (event.charactersIgnoringModifiers) {
|
||||
|
@@ -1761,6 +1761,8 @@ pub fn keyEventIsBinding(
|
||||
// sequences) or the root set.
|
||||
const set = self.keyboard.bindings orelse &self.config.keybind.set;
|
||||
|
||||
// log.warn("text keyEventIsBinding event={} match={}", .{ event, set.getEvent(event) != null });
|
||||
|
||||
// If we have a keybinding for this event then we return true.
|
||||
return set.getEvent(event) != null;
|
||||
}
|
||||
|
@@ -4410,23 +4410,23 @@ pub const Keybinds = struct {
|
||||
// set the expected keybind for the menu.
|
||||
try self.set.put(
|
||||
alloc,
|
||||
.{ .key = .{ .unicode = '+' }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
||||
.{ .key = .{ .physical = .equal }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
||||
.{ .increase_font_size = 1 },
|
||||
);
|
||||
try self.set.put(
|
||||
alloc,
|
||||
.{ .key = .{ .physical = .equal }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
||||
.{ .key = .{ .unicode = '+' }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
||||
.{ .increase_font_size = 1 },
|
||||
);
|
||||
|
||||
try self.set.put(
|
||||
alloc,
|
||||
.{ .key = .{ .physical = .minus }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
||||
.{ .key = .{ .unicode = '-' }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
||||
.{ .decrease_font_size = 1 },
|
||||
);
|
||||
try self.set.put(
|
||||
alloc,
|
||||
.{ .key = .{ .physical = .digit_0 }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
||||
.{ .key = .{ .unicode = '0' }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
||||
.{ .reset_font_size = {} },
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user