diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 23:31:19 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:16:28 -0300 |
| commit | 2504b38647653db091aa7709afcea0dbe75f7a95 (patch) | |
| tree | 2fefb992a86d2432c00ab4b431f65b649421a0dd /src/edit.zig | |
| parent | 2aa1801dbad2a26348aef085d9dee8096f8d2eb3 (diff) | |
| download | pardes-2504b38647653db091aa7709afcea0dbe75f7a95.tar.gz pardes-2504b38647653db091aa7709afcea0dbe75f7a95.zip | |
normal, modal, File, edit: small ones: tryFind inlined (its clamp never bound), the smart-case haystack is allocLowerString, the two WordTargets nothing produces go, File.lineCount is modal.cursorLineCount's alias, and pasteRegister and ClipRequest share one Paste enum
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/edit.zig')
| -rw-r--r-- | src/edit.zig | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/edit.zig b/src/edit.zig index a7449dcf..14060f45 100644 --- a/src/edit.zig +++ b/src/edit.zig @@ -73,16 +73,15 @@ fn selText(p: *Pardes, t: *Text) []const u8 { /// `p` / `P` / `R` from the register the command names: this range's value /// of it. The clipboard's is asked of the shell and pasted when it answers, /// once, at the primary. -pub fn pasteRegister(p: *Pardes, t: *Text, how: enum { after, before, replace }, count: usize) void { +/// Where a paste goes: after the selection, before it, or over it. +pub const Paste = enum { after, before, replace }; + +pub fn pasteRegister(p: *Pardes, t: *Text, how: Paste, count: usize) void { const name: u21 = if (p.register != 0) p.register else Registers.default; if (name == '+' or name == '*') { if (!normal.multiOnce(p)) return; const pane = t.pane() orelse return; - return clipRequest(p, p.paneIdOf(pane) orelse return, switch (how) { - .after => .after, - .before => .before, - .replace => .replace, - }); + return clipRequest(p, p.paneIdOf(pane) orelse return, how); } const y = registerValue(p, t, name) orelse return; switch (how) { @@ -96,10 +95,10 @@ pub fn pasteRegister(p: *Pardes, t: *Text, how: enum { after, before, replace }, pub const ClipRequest = struct { pane: usize, serial: u32, - mode: enum { after, before, replace }, + mode: Paste, }; -pub fn clipRequest(p: *Pardes, id: usize, mode: @FieldType(ClipRequest, "mode")) void { +pub fn clipRequest(p: *Pardes, id: usize, mode: Paste) void { const pane = p.panes[id] orelse return; p.clip_pending = .{ .pane = id, .serial = pane.serial, .mode = mode }; p.emit(.read_clipboard); |
