From abeccae181403d8db145a3c5f72c77648d325b53 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:27:11 -0300 Subject: edit: setClipboard, with one caller, goes: clipYank names the + register first and its PDF branch yanks into it Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/edit.zig | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/edit.zig b/src/edit.zig index 72cfe31a..a7449dcf 100644 --- a/src/edit.zig +++ b/src/edit.zig @@ -46,13 +46,6 @@ pub fn setYank(p: *Pardes, text: []const u8) void { if (name == '+' and (one or p.multi_first)) p.emit(.{ .set_clipboard = {} }); } -pub fn setClipboard(p: *Pardes, text: []const u8) void { - const named = p.register; - p.register = '+'; - defer p.register = named; - setYank(p, text); -} - /// Value `i` of register `name` as the command at range `i` reads it, the /// computed registers included: `#` is the range's number from 1, `.` its /// text, `%` the file's name, `_` nothing. Scratch- or register-owned. @@ -182,14 +175,14 @@ fn pasteInto(p: *Pardes, t: *Text, bytes: []const u8) void { } pub fn clipYank(p: *Pardes, pane: *Pane, main_only: bool) void { - if (comptime pdf_enabled) if (pane.pdf) |pv| { - if (pv.selection_text.len > 0) setClipboard(p, pv.selection_text); - return; - }; // helix's `"+y`: the clipboard register, and only it const named = p.register; p.register = '+'; defer p.register = named; + if (comptime pdf_enabled) if (pane.pdf) |pv| { + if (pv.selection_text.len > 0) setYank(p, pv.selection_text); + return; + }; if (pane.body.nsel > 0 and !main_only) { normal.replaySels(p, &pane.body, .{ .normal = .{ .edit = .{ .kind = .yank, .count = 1 } } }); } else { -- cgit v1.3