mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 17:26:09 +03:00
Merge branch 'configure-scroll-speed' of github.com:em-dash/ghostty into configure-scroll-speed
This commit is contained in:
@ -264,7 +264,6 @@ class AppDelegate: NSObject,
|
|||||||
syncMenuShortcut(action: "paste_from_clipboard", menuItem: self.menuPaste)
|
syncMenuShortcut(action: "paste_from_clipboard", menuItem: self.menuPaste)
|
||||||
syncMenuShortcut(action: "select_all", menuItem: self.menuSelectAll)
|
syncMenuShortcut(action: "select_all", menuItem: self.menuSelectAll)
|
||||||
|
|
||||||
syncMenuShortcut(action: "toggle_fullscreen", menuItem: self.menuToggleFullScreen)
|
|
||||||
syncMenuShortcut(action: "toggle_split_zoom", menuItem: self.menuZoomSplit)
|
syncMenuShortcut(action: "toggle_split_zoom", menuItem: self.menuZoomSplit)
|
||||||
syncMenuShortcut(action: "goto_split:previous", menuItem: self.menuPreviousSplit)
|
syncMenuShortcut(action: "goto_split:previous", menuItem: self.menuPreviousSplit)
|
||||||
syncMenuShortcut(action: "goto_split:next", menuItem: self.menuNextSplit)
|
syncMenuShortcut(action: "goto_split:next", menuItem: self.menuNextSplit)
|
||||||
@ -283,6 +282,12 @@ class AppDelegate: NSObject,
|
|||||||
syncMenuShortcut(action: "reset_font_size", menuItem: self.menuResetFontSize)
|
syncMenuShortcut(action: "reset_font_size", menuItem: self.menuResetFontSize)
|
||||||
syncMenuShortcut(action: "inspector:toggle", menuItem: self.menuTerminalInspector)
|
syncMenuShortcut(action: "inspector:toggle", menuItem: self.menuTerminalInspector)
|
||||||
|
|
||||||
|
// This menu item is NOT synced with the configuration because it disables macOS
|
||||||
|
// global fullscreen keyboard shortcut. The shortcut in the Ghostty config will continue
|
||||||
|
// to work but it won't be reflected in the menu item.
|
||||||
|
//
|
||||||
|
// syncMenuShortcut(action: "toggle_fullscreen", menuItem: self.menuToggleFullScreen)
|
||||||
|
|
||||||
// Dock menu
|
// Dock menu
|
||||||
reloadDockMenu()
|
reloadDockMenu()
|
||||||
}
|
}
|
||||||
|
@ -234,8 +234,8 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</menuItem>
|
</menuItem>
|
||||||
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
|
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
|
||||||
<menuItem title="Toggle Full Screen" id="8kY-Pi-KaY">
|
<menuItem title="Toggle Full Screen" keyEquivalent="f" id="8kY-Pi-KaY">
|
||||||
<modifierMask key="keyEquivalentModifierMask"/>
|
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="toggleGhosttyFullScreen:" target="-1" id="QB9-7R-xyc"/>
|
<action selector="toggleGhosttyFullScreen:" target="-1" id="QB9-7R-xyc"/>
|
||||||
</connections>
|
</connections>
|
||||||
|
@ -765,6 +765,24 @@ pub const Surface = struct {
|
|||||||
break :translate_mods translate_mods;
|
break :translate_mods translate_mods;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const event_text: ?[]const u8 = event_text: {
|
||||||
|
// This logic only applies to macOS.
|
||||||
|
if (comptime builtin.os.tag != .macos) break :event_text event.text;
|
||||||
|
|
||||||
|
// If the modifiers are ONLY "control" then we never process
|
||||||
|
// the event text because we want to do our own translation so
|
||||||
|
// we can handle ctrl+c, ctrl+z, etc.
|
||||||
|
//
|
||||||
|
// This is specifically because on macOS using the
|
||||||
|
// "Dvorak - QWERTY ⌘" keyboard layout, ctrl+z is translated as
|
||||||
|
// "/" (the physical key that is z on a qwerty keyboard). But on
|
||||||
|
// other layouts, ctrl+<char> is not translated by AppKit. So,
|
||||||
|
// we just avoid this by never allowing AppKit to translate
|
||||||
|
// ctrl+<char> and instead do it ourselves.
|
||||||
|
const ctrl_only = comptime (input.Mods{ .ctrl = true }).int();
|
||||||
|
break :event_text if (mods.binding().int() == ctrl_only) null else event.text;
|
||||||
|
};
|
||||||
|
|
||||||
// Translate our key using the keymap for our localized keyboard layout.
|
// Translate our key using the keymap for our localized keyboard layout.
|
||||||
// We only translate for keydown events. Otherwise, we only care about
|
// We only translate for keydown events. Otherwise, we only care about
|
||||||
// the raw keycode.
|
// the raw keycode.
|
||||||
@ -772,7 +790,7 @@ pub const Surface = struct {
|
|||||||
const result: input.Keymap.Translation = if (is_down) translate: {
|
const result: input.Keymap.Translation = if (is_down) translate: {
|
||||||
// If the event provided us with text, then we use this as a result
|
// If the event provided us with text, then we use this as a result
|
||||||
// and do not do manual translation.
|
// and do not do manual translation.
|
||||||
const result: input.Keymap.Translation = if (event.text) |text| .{
|
const result: input.Keymap.Translation = if (event_text) |text| .{
|
||||||
.text = text,
|
.text = text,
|
||||||
.composing = event.composing,
|
.composing = event.composing,
|
||||||
} else try self.app.keymap.translate(
|
} else try self.app.keymap.translate(
|
||||||
|
@ -26,7 +26,7 @@ const oni = @import("oniguruma");
|
|||||||
/// handling them well requires a non-regex approach.
|
/// handling them well requires a non-regex approach.
|
||||||
pub const regex = "(?:" ++ url_scheme ++ ")(?:[^" ++ url_exclude ++ "]*[^" ++ url_exclude ++ ").]|[^" ++ url_exclude ++ "(]*\\([^" ++ url_exclude ++ ")]*\\))";
|
pub const regex = "(?:" ++ url_scheme ++ ")(?:[^" ++ url_exclude ++ "]*[^" ++ url_exclude ++ ").]|[^" ++ url_exclude ++ "(]*\\([^" ++ url_exclude ++ ")]*\\))";
|
||||||
const url_scheme = "ipfs:|ipns:|magnet:|mailto:|gemini://|gopher://|https://|http://|news:|file:|git://|ssh:|ftp://";
|
const url_scheme = "ipfs:|ipns:|magnet:|mailto:|gemini://|gopher://|https://|http://|news:|file:|git://|ssh:|ftp://";
|
||||||
const url_exclude = "\u{0000}-\u{001F}\u{007F}-\u{009F}<>\x22\\s{-}\\^⟨⟩\x60";
|
const url_exclude = "\u{0000}-\u{001F}\u{007F}-\u{009F}<>\x22\x27\\s{-}\\^⟨⟩\x60";
|
||||||
|
|
||||||
test "url regex" {
|
test "url regex" {
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
@ -67,6 +67,14 @@ test "url regex" {
|
|||||||
.input = "Link period https://example.com. More text.",
|
.input = "Link period https://example.com. More text.",
|
||||||
.expect = "https://example.com",
|
.expect = "https://example.com",
|
||||||
},
|
},
|
||||||
|
.{
|
||||||
|
.input = "Link in double quotes \"https://example.com\" and more",
|
||||||
|
.expect = "https://example.com",
|
||||||
|
},
|
||||||
|
.{
|
||||||
|
.input = "Link in single quotes 'https://example.com' and more",
|
||||||
|
.expect = "https://example.com",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (cases) |case| {
|
for (cases) |case| {
|
||||||
|
@ -1895,6 +1895,11 @@ test "ctrlseq: normal ctrl c" {
|
|||||||
try testing.expectEqual(@as(u8, 0x03), seq.?);
|
try testing.expectEqual(@as(u8, 0x03), seq.?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "ctrlseq: normal ctrl c, right control" {
|
||||||
|
const seq = ctrlSeq("c", .{ .ctrl = true, .sides = .{ .ctrl = .right } });
|
||||||
|
try testing.expectEqual(@as(u8, 0x03), seq.?);
|
||||||
|
}
|
||||||
|
|
||||||
test "ctrlseq: alt should be allowed" {
|
test "ctrlseq: alt should be allowed" {
|
||||||
const seq = ctrlSeq("c", .{ .alt = true, .ctrl = true });
|
const seq = ctrlSeq("c", .{ .alt = true, .ctrl = true });
|
||||||
try testing.expectEqual(@as(u8, 0x03), seq.?);
|
try testing.expectEqual(@as(u8, 0x03), seq.?);
|
||||||
|
Reference in New Issue
Block a user