diff --git a/src/Surface.zig b/src/Surface.zig index 410f717b0..99c740c89 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -2330,18 +2330,14 @@ fn copySelectionToClipboards( /// /// This must be called with the renderer mutex held. fn setSelection(self: *Surface, sel_: ?terminal.Selection) !void { - const prev_ = self.io.terminal.screens.active.selection; try self.io.terminal.screens.active.select(sel_); // If copy on select is false then exit early. if (self.config.copy_on_select == .false) return; // Set our selection clipboard. If the selection is cleared we do not - // 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. + // clear the clipboard. const sel = sel_ orelse return; - if (prev_) |prev| if (sel.eql(prev)) return; switch (self.config.copy_on_select) { .false => unreachable, // handled above with an early exit