From e6f530354cc0b669ac87e851fe2fc94942ca0a8e Mon Sep 17 00:00:00 2001 From: LimaTheLime Date: Sun, 23 Feb 2025 11:22:00 +0000 Subject: [PATCH] Moved copy to break condition, fixed syntax and config --- src/Surface.zig | 8 +++++--- src/config/Config.zig | 6 +----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Surface.zig b/src/Surface.zig index ca2a7da31..cee125a33 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -1465,7 +1465,7 @@ fn setSelection(self: *Surface, sel_: ?terminal.Selection) !void { // If copy on select is false then exit early. if (self.config.copy_on_select == .false) return; - // clear the clipboard. If the selection is set, we only set the clipboard + // Clear the clipboard. If the selection is set, we only set the clipboard // again if it changed, since setting the clipboard can be an expensive // operation. const sel = sel_ orelse return; @@ -3109,8 +3109,10 @@ pub fn mouseButtonCallback( // If we already have a selection and the selection contains // where we clicked then we don't want to modify the selection. if (self.io.terminal.screen.selection) |prev_sel| { - try self.copyOnMouseAction(prev_sel, self.config.copy_on_right_click); - if (prev_sel.contains(screen, pin)) break :sel; + if (prev_sel.contains(screen, pin)) { + try self.copyOnMouseAction(prev_sel, self.config.copy_on_right_click); + break :sel; + } // The selection doesn't contain our pin, so we create a new // word selection where we clicked. } diff --git a/src/config/Config.zig b/src/config/Config.zig index ff8a734df..2861c12b9 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -1512,11 +1512,7 @@ keybind: Keybinds = .{}, else => .false, }, -@"copy-on-right-click": CopyOnMouseAction = switch (builtin.os.tag) { - .linux => .false, - .macos => .false, - else => .false, -}, +@"copy-on-right-click": CopyOnMouseAction = .false, /// The time in milliseconds between clicks to consider a click a repeat /// (double, triple, etc.) or an entirely new single click. A value of zero will