Moved copy to break condition, fixed syntax and config

This commit is contained in:
LimaTheLime
2025-02-23 11:22:00 +00:00
parent cc55ffa26d
commit e6f530354c
2 changed files with 6 additions and 8 deletions

View File

@ -1465,7 +1465,7 @@ fn setSelection(self: *Surface, sel_: ?terminal.Selection) !void {
// If copy on select is false then exit early. // If copy on select is false then exit early.
if (self.config.copy_on_select == .false) return; 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 // again if it changed, since setting the clipboard can be an expensive
// operation. // operation.
const sel = sel_ orelse return; const sel = sel_ orelse return;
@ -3109,8 +3109,10 @@ pub fn mouseButtonCallback(
// If we already have a selection and the selection contains // If we already have a selection and the selection contains
// where we clicked then we don't want to modify the selection. // where we clicked then we don't want to modify the selection.
if (self.io.terminal.screen.selection) |prev_sel| { if (self.io.terminal.screen.selection) |prev_sel| {
if (prev_sel.contains(screen, pin)) {
try self.copyOnMouseAction(prev_sel, self.config.copy_on_right_click); try self.copyOnMouseAction(prev_sel, self.config.copy_on_right_click);
if (prev_sel.contains(screen, pin)) break :sel; break :sel;
}
// The selection doesn't contain our pin, so we create a new // The selection doesn't contain our pin, so we create a new
// word selection where we clicked. // word selection where we clicked.
} }

View File

@ -1512,11 +1512,7 @@ keybind: Keybinds = .{},
else => .false, else => .false,
}, },
@"copy-on-right-click": CopyOnMouseAction = switch (builtin.os.tag) { @"copy-on-right-click": CopyOnMouseAction = .false,
.linux => .false,
.macos => .false,
else => .false,
},
/// The time in milliseconds between clicks to consider a click a repeat /// 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 /// (double, triple, etc.) or an entirely new single click. A value of zero will