mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-26 06:48:33 +00:00
surface: sync middle-click paste source with copy-on-select
Middle-click paste previously always read from the selection clipboard (falling back to the standard clipboard on platforms without one). Now the paste source follows copy-on-select: - copy-on-select = true: paste from selection clipboard (unchanged) - copy-on-select = clipboard: paste from system clipboard - copy-on-select = false: paste from selection clipboard (unchanged) Fixes ghostty-org/ghostty#9788.
This commit is contained in:
@@ -4007,12 +4007,19 @@ pub fn mouseButtonCallback(
|
||||
}
|
||||
}
|
||||
|
||||
// Middle-click pastes from our selection clipboard
|
||||
// Middle-click paste source follows copy-on-select: when copy-on-select
|
||||
// targets the selection clipboard, middle-click reads from it; when
|
||||
// copy-on-select targets the system clipboard, middle-click reads from
|
||||
// that instead. Falls back to the standard clipboard on platforms that
|
||||
// do not support the selection clipboard.
|
||||
if (button == .middle and action == .press) {
|
||||
const clipboard: apprt.Clipboard = if (self.rt_surface.supportsClipboard(.selection))
|
||||
.selection
|
||||
else
|
||||
.standard;
|
||||
const clipboard: apprt.Clipboard = switch (self.config.copy_on_select) {
|
||||
.clipboard => .standard,
|
||||
.true, .false => if (self.rt_surface.supportsClipboard(.selection))
|
||||
.selection
|
||||
else
|
||||
.standard,
|
||||
};
|
||||
_ = try self.startClipboardRequest(clipboard, .{ .paste = {} });
|
||||
}
|
||||
|
||||
|
||||
@@ -2404,8 +2404,11 @@ keybind: Keybinds = .{},
|
||||
/// The value `clipboard` will always copy text to the selection clipboard
|
||||
/// as well as the system clipboard.
|
||||
///
|
||||
/// Middle-click paste will always use the selection clipboard. Middle-click
|
||||
/// paste is always enabled even if this is `false`.
|
||||
/// Middle-click paste is always enabled even if this is `false`. The
|
||||
/// clipboard it pastes from follows this setting: with `true` (or `false`)
|
||||
/// it reads from the selection clipboard (falling back to the system
|
||||
/// clipboard on platforms without a selection clipboard); with `clipboard`
|
||||
/// it reads from the system clipboard.
|
||||
///
|
||||
/// The default value is true on Linux and macOS.
|
||||
@"copy-on-select": CopyOnSelect = switch (builtin.os.tag) {
|
||||
|
||||
Reference in New Issue
Block a user