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,12 +1043,16 @@ extension Ghostty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If this event as-is would result in a key binding then we send it.
|
// If this event as-is would result in a key binding then we send it.
|
||||||
if let surface,
|
if let surface {
|
||||||
ghostty_surface_key_is_binding(
|
var ghosttyEvent = event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS)
|
||||||
surface,
|
let match = (event.characters ?? "").withCString { ptr in
|
||||||
event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS)) {
|
ghosttyEvent.text = ptr
|
||||||
self.keyDown(with: event)
|
return ghostty_surface_key_is_binding(surface, ghosttyEvent)
|
||||||
return true
|
}
|
||||||
|
if match {
|
||||||
|
self.keyDown(with: event)
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let equivalent: String
|
let equivalent: String
|
||||||
|
@@ -1761,6 +1761,8 @@ pub fn keyEventIsBinding(
|
|||||||
// sequences) or the root set.
|
// sequences) or the root set.
|
||||||
const set = self.keyboard.bindings orelse &self.config.keybind.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.
|
// If we have a keybinding for this event then we return true.
|
||||||
return set.getEvent(event) != null;
|
return set.getEvent(event) != null;
|
||||||
}
|
}
|
||||||
|
@@ -4410,23 +4410,23 @@ pub const Keybinds = struct {
|
|||||||
// set the expected keybind for the menu.
|
// set the expected keybind for the menu.
|
||||||
try self.set.put(
|
try self.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .unicode = '+' }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
.{ .key = .{ .physical = .equal }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
||||||
.{ .increase_font_size = 1 },
|
.{ .increase_font_size = 1 },
|
||||||
);
|
);
|
||||||
try self.set.put(
|
try self.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .physical = .equal }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
.{ .key = .{ .unicode = '+' }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
||||||
.{ .increase_font_size = 1 },
|
.{ .increase_font_size = 1 },
|
||||||
);
|
);
|
||||||
|
|
||||||
try self.set.put(
|
try self.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .physical = .minus }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
.{ .key = .{ .unicode = '-' }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
||||||
.{ .decrease_font_size = 1 },
|
.{ .decrease_font_size = 1 },
|
||||||
);
|
);
|
||||||
try self.set.put(
|
try self.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .physical = .digit_0 }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
.{ .key = .{ .unicode = '0' }, .mods = inputpkg.ctrlOrSuper(.{}) },
|
||||||
.{ .reset_font_size = {} },
|
.{ .reset_font_size = {} },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user