From ff953a6236ebdf97c73deda86fd9005906a2071b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 27 Sep 2026 22:09:27 -0300 Subject: Move text editing out of pardes.zig into edit.zig Pure move, no behaviour change (acme keeps this in text.c): which text a pane edits and how it maps to the screen (editText, editTextEol, setEditText, paneCursorLines, paneByteAtDisplay, pinPaneCursor, flatSurface, paneWrapWidth), insert mode (enterInsert, handleInsert, insertKey, insertTab, exitInsert, clampFileCursor), the d/c/y/p edit operations with replace, case, join, indent, comment, number, textobjects and surround, undo and redo, yank/clipboard/paste (setYank, setClipboard, ClipRequest, clipRequest, typeToTty, applyPaste, clipYank), and the pointer selections as text (PointerTextSelection, pointerTextSelection, capturePointerSelection, paneText, pointerSourceLine, selectionText, spanHas, currentSelText), with four tests, go verbatim to edit.zig. The methods become free functions taking `p: *Pardes`; calls change from `p.insertKey(..)` to `edit.insertKey(p, ..)` (pardes.zig, body_layer.zig, selection_pipe.zig, builtins.zig, test/hxdiff.zig, test/perf.zig). In executeNormalAction the `.edit => |edit|` capture becomes `|op|`, since it would now shadow the edit import. test/lspbench.zig's first anchor follows its needle into src/edit.zig. Co-Authored-By: Claude Opus 5.5 --- src/builtins.zig | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/builtins.zig') diff --git a/src/builtins.zig b/src/builtins.zig index ad2c5f6a..87679f64 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1,6 +1,7 @@ //! Command structs and runtime settings form the builtin registry; bindings live in config.zig. const std = @import("std"); const pardes = @import("pardes.zig"); +const edit = @import("edit.zig"); const colors = @import("colors.zig"); const Pardes = pardes.Pardes; const Pane = pardes.Pane; @@ -431,7 +432,7 @@ pub const Ascii = struct { pub const ClipYank = struct { pub fn run(c: Ctx) void { - c.p.clipYank(c.pane, false); + edit.clipYank(c.p, c.pane, false); } }; @@ -439,25 +440,25 @@ pub const ClipYank = struct { /// cursor's. One cursor makes them the same word. pub const ClipYankMain = struct { pub fn run(c: Ctx) void { - c.p.clipYank(c.pane, true); + edit.clipYank(c.p, c.pane, true); } }; pub const ClipPaste = struct { pub fn run(c: Ctx) void { - c.p.clipRequest(c.id, .after); + edit.clipRequest(c.p, c.id, .after); } }; pub const ClipPasteBefore = struct { pub fn run(c: Ctx) void { - c.p.clipRequest(c.id, .before); + edit.clipRequest(c.p, c.id, .before); } }; pub const ClipReplace = struct { pub fn run(c: Ctx) void { - c.p.clipRequest(c.id, .replace); + edit.clipRequest(c.p, c.id, .replace); } }; -- cgit v1.3