diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 19:29:06 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 22:03:21 -0300 |
| commit | 542e6677e23e277ce39edb3e96d729e9adca99d0 (patch) | |
| tree | f817beb6ac8344b6ae5f33edd6a5365374a02003 /src/normal.zig | |
| parent | c6e5b0aec57394f7459377dae1d3fa45550e7bf0 (diff) | |
| download | pardes-542e6677e23e277ce39edb3e96d729e9adca99d0.tar.gz pardes-542e6677e23e277ce39edb3e96d729e9adca99d0.zip | |
split pardes.zig by noun, keys: the keyboard leaves the session for src/keys.zig, free functions on it as mouse.zig is the mouse: handleKey, leaderKey, replayKeys, cycleMode, toggleTty, questionChoices and answerQuestion; their callers name keys (builtins.zig, ninep/ctl.zig, normal.zig, whose own `keys` are the replayed keys, so it imports the file as keyboard; update calls keys.handleKey); comments citing Pardes.handleKey and Pardes.answerQuestion cite keys; tests moved with them, by name: Esc back into a tty leaves its view at the prompt; Del from a key asks which neighbour takes the rows; nothing else asks; raw tty Esc backs out and Shift-Esc is the program's Esc; with ProgramEsc raw tty Escape only leaves at a shell prompt; the Del question shows only once its delay is up: a quick SPC d j never sees it; raw tty Ctrl-B switches to editor mode without sending child input; raw tty forwards Ctrl letters and former global shortcuts to the child; s in a header selects in the header's own text; a pure move, no field touched, a dump and the wire as they were; gates on tui: core-test 960/960, behaviour-test 238/238
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/normal.zig')
| -rw-r--r-- | src/normal.zig | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/normal.zig b/src/normal.zig index fefdd88c..6a65ee3e 100644 --- a/src/normal.zig +++ b/src/normal.zig @@ -12,6 +12,7 @@ const modal = @import("modal.zig"); const panes = @import("panes.zig"); const edit = @import("edit.zig"); const config = @import("config.zig"); +const keyboard = @import("keys.zig"); const pdf_enabled = panes.Pdf.enabled; const Pane = panes.Pane; const Text = panes.Text; @@ -885,7 +886,7 @@ fn executeNormalAction(p: *Pardes, t: *Text, a: modal.Normal.Action) void { const notation = p.registers.value(name, 0) orelse return; const keys = Macro.decode(p.scratch.allocator(), notation) catch return; p.register = 0; - for (0..a.count) |_| p.replayKeys(keys); + for (0..a.count) |_| keyboard.replayKeys(p, keys); }, .repeat_insert => { const m = &p.macro; @@ -897,10 +898,10 @@ fn executeNormalAction(p: *Pardes, t: *Text, a: modal.Normal.Action) void { // helix repeat_last_insert: the command once, what was typed // count times, and out of insert mode the way it was left const typed = @min(m.typed_from, keys.len); - p.replayKeys(keys[0..typed]); + keyboard.replayKeys(p, keys[0..typed]); if (keys.len == typed) return; - for (0..a.count) |_| p.replayKeys(keys[typed .. keys.len - 1]); - p.replayKeys(keys[keys.len - 1 ..]); + for (0..a.count) |_| keyboard.replayKeys(p, keys[typed .. keys.len - 1]); + keyboard.replayKeys(p, keys[keys.len - 1 ..]); }, // prefix keys: what they begin is the command .goto_prefix, .view_prefix, .next_prefix, .prev_prefix, .register_prefix, .view_prefix_sticky => {}, |
