Implement "Paste Selection" on macOS like Terminal.app

This commit is contained in:
Wes Campaigne
2025-01-06 19:01:19 -05:00
committed by Mitchell Hashimoto
parent 29c2f095a6
commit e86b9a112e
9 changed files with 78 additions and 21 deletions

View File

@@ -1389,13 +1389,10 @@ keybind: Keybinds = .{},
/// and the system clipboard on macOS. Middle-click paste is always enabled
/// even if this is `false`.
///
/// The default value is true on Linux and false on macOS. macOS copy on
/// select behavior is not typical for applications so it is disabled by
/// default. On Linux, this is a standard behavior so it is enabled by
/// default.
/// The default value is true on Linux and macOS.
@"copy-on-select": CopyOnSelect = switch (builtin.os.tag) {
.linux => .true,
.macos => .false,
.macos => .true,
else => .false,
},
@@ -2749,6 +2746,13 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config {
.{ .toggle_fullscreen = {} },
);
// Selection clipboard paste, matches Terminal.app
try result.keybind.set.put(
alloc,
.{ .key = .{ .translated = .v }, .mods = .{ .super = true, .shift = true } },
.{ .paste_from_selection = {} },
);
// "Natural text editing" keybinds. This forces these keys to go back
// to legacy encoding (not fixterms). It seems macOS users more than
// others are used to these keys so we set them as defaults. If