diff --git a/macos/Sources/Ghostty/SurfaceView_AppKit.swift b/macos/Sources/Ghostty/SurfaceView_AppKit.swift index 921c32c8b..af9895c35 100644 --- a/macos/Sources/Ghostty/SurfaceView_AppKit.swift +++ b/macos/Sources/Ghostty/SurfaceView_AppKit.swift @@ -1043,12 +1043,16 @@ 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)) { - self.keyDown(with: event) - return true + 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 diff --git a/src/Surface.zig b/src/Surface.zig index a71c180ff..138cd4839 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -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; } diff --git a/src/config/Config.zig b/src/config/Config.zig index 251dca147..0ec61d4c5 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -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 = {} }, );