diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-27 22:09:27 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | ff953a6236ebdf97c73deda86fd9005906a2071b (patch) | |
| tree | 9871a9aa6b562f6a2fa9f01219a70b52a1e474c1 /src/body_layer.zig | |
| parent | 08942ef68b10d4ce478bd3c62d306f2a633d51cb (diff) | |
| download | pardes-ff953a6236ebdf97c73deda86fd9005906a2071b.tar.gz pardes-ff953a6236ebdf97c73deda86fd9005906a2071b.zip | |
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 <[email protected]>
Diffstat (limited to 'src/body_layer.zig')
| -rw-r--r-- | src/body_layer.zig | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/body_layer.zig b/src/body_layer.zig index d7ddbfb5..8c345b97 100644 --- a/src/body_layer.zig +++ b/src/body_layer.zig @@ -5,6 +5,7 @@ //! and cursor. const std = @import("std"); const pardes = @import("pardes.zig"); +const edit = @import("edit.zig"); const config = @import("config.zig"); const limits = @import("memory.zig").limits; const layout = @import("layout.zig"); @@ -180,7 +181,7 @@ fn paintSourceSelection(p: *Pardes, pane: *Pane, r: Rect, rows: []const Pane.Poi var visible: i32 = 0; while (visible < @as(i32, r.h -| BOX_H)) : (visible += 1) { const source = pane.wrapAt(visible); - const line = Pardes.pointerSourceLine(pane, terminal_lines, source.line); + const line = edit.pointerSourceLine(pane, terminal_lines, source.line); const start = @min(line.len, @as(usize, @intCast(@max(0, source.at)))); const next = pane.wrapAt(visible + 1); const end = if (next.line == source.line) @min(line.len, @as(usize, @intCast(@max(0, next.at)))) else line.len; @@ -401,7 +402,7 @@ pub fn renderBody(p: *Pardes, arena: std.mem.Allocator, pane: *Pane, r: Rect, id .arow = if (pane.vsel.active) pane.vsel.row else pane.cur_row, .acol = if (pane.vsel.active) pane.vsel.col else pane.cur_col, } else pane.sels[si]; - const bnd = Pardes.cellBounds(sr); + const bnd = edit.cellBounds(sr); const hover_only = primary and modal_hover and pane.mode != .normal and !preview; const bg = if (hover_only) colors.mix(page_rgb, colors.mix(page_rgb, th.sel_bg)) |
