diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-27 22:13:34 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | f1025c18a78c02ebf157f0e3a5d9552605c082e8 (patch) | |
| tree | d5e394baa9b74ed20b2e5549fbbc7f24917caa2a /src/edit.zig | |
| parent | ff953a6236ebdf97c73deda86fd9005906a2071b (diff) | |
| download | pardes-f1025c18a78c02ebf157f0e3a5d9552605c082e8.tar.gz pardes-f1025c18a78c02ebf157f0e3a5d9552605c082e8.zip | |
Move helix normal mode out of pardes.zig into normal.zig
Pure move, no behaviour change: the key-to-role matching (isPrefix,
roleBindingName, normalInput), multiOnce, the selection regex prompt
(startSelRegex, selRegexArmed, applySelRegex), KeyState, Replay and
replaySels, handleNormal, executeNormalAction and handlePdfNormal, with two
tests, go verbatim to normal.zig.
The methods become free functions taking `p: *Pardes`; their 22 call sites
(handleKey, the mouse, look walk, lsp, runBuiltin, body drawing and edit.zig)
change from `p.handleNormal(..)` to `normal.handleNormal(p, ..)`.
test/lspbench.zig's second anchor follows its needle into src/normal.zig.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/edit.zig')
| -rw-r--r-- | src/edit.zig | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/edit.zig b/src/edit.zig index e44a3364..f829decc 100644 --- a/src/edit.zig +++ b/src/edit.zig @@ -3,6 +3,7 @@ //! operations, replace, case, join, indent, comments, numbers, textobjects //! and surround, undo, yank and paste, and the pointer selections as text. const pardes = @import("pardes.zig"); +const normal = @import("normal.zig"); const std = @import("std"); const modal = @import("modal.zig"); const panes = @import("panes.zig"); @@ -86,7 +87,7 @@ pub fn applyPaste(p: *Pardes, bytes: []const u8) void { const range: @TypeOf(Pardes.tagSelBounds(pane)) = if (pane.tag_sel) Pardes.tagSelBounds(pane) else .{ .lo = pane.tag_col, .hi = pane.tag_col }; const hi = if (pane.tag_sel) modal.nextGrapheme(text, range.hi) else range.hi; _ = p.replaceTagText(pane, range.lo, hi, bytes); - if (Pardes.selRegexArmed(pane)) |a| p.applySelRegex(pane, a.pat, a.split); + if (normal.selRegexArmed(pane)) |a| normal.applySelRegex(p, pane, a.pat, a.split); return; } if (pane.isTerminal() and pane.mode == .tty) return typeToTty(p, id, pane, bytes); @@ -103,7 +104,7 @@ pub fn clipYank(p: *Pardes, pane: *Pane, main_only: bool) void { return; }; if (pane.nsel > 0 and !main_only) { - p.replaySels(pane, .{ .normal = .{ .edit = .{ .kind = .yank, .count = 1 } } }); + normal.replaySels(p, pane, .{ .normal = .{ .edit = .{ .kind = .yank, .count = 1 } } }); } else { const others = pane.nsel; pane.nsel = 0; @@ -471,7 +472,7 @@ pub fn enterInsert(p: *Pardes, pane: *Pane, where: InsertAt, cnt: usize) void { pub fn handleInsert(p: *Pardes, pane: *Pane, key: Key) void { if (pane.nsel == 0) return insertKey(p, pane, key); - p.replaySels(pane, .{ .insert = key }); + normal.replaySels(p, pane, .{ .insert = key }); } pub fn insertKey(p: *Pardes, pane: *Pane, key: Key) void { |
