From 3b31e0484bd06658f10cd9165b76cb1ca3b198bd Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 00:20:16 -0300 Subject: modal, normal, pdf_view, Text, syntax, edit: one key layer: an Action is the role the key named and what it was given (a count, a literal, ] or [), not a second union of sixteen sub-enums the roles were mapped onto one if at a time; a context's roles are tried in their enum order, the pending prefix and m sub-key are roles too, the text's executor and the PDF's switch flat on the role, and pdf_view.applyNormal(core, pane, action) does what a page cannot (Last, the leader, the tag, a search) instead of handing a seven-value enum back; no key does anything new; Text.normal's walked shape changes (wire semantics); helix-keys.md says how the keys are read Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- docs/helix-keys.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'docs') diff --git a/docs/helix-keys.md b/docs/helix-keys.md index 6c05e3ce..8cfd53ad 100644 --- a/docs/helix-keys.md +++ b/docs/helix-keys.md @@ -21,14 +21,17 @@ which the harness runs without. Code map, by SYMBOL — line numbers rot, names do not. Body-normal key RECOGNITION is `modal.Normal` in `src/modal.zig`: a state machine over `Role` (one -per bound command, matched against `src/config.zig`'s chord lists by -`normalInput` in `src/normal.zig`), a `Prefix`, a `MatchSub` and a count, emitting a -semantic `Action` that both the text and PDF adapters consume. It knows -nothing about panes or text. Then it is EXECUTED: `Key` and `handleKey` in -`src/pardes.zig` (intercept order is load-bearing, see the comment there); -`handleNormal` (parses directly into `Pane.normal`), `executeNormalAction`, -`replaySels` and `multiOnce` in `src/normal.zig`; `setPaneRange` (helix range -→ pane state); and `enterInsert`, `handleInsert` / `insertKey`, `insertTab`, +per bound command, named as `src/config.zig` binds it and matched against its +chord lists by `normalInput` in `src/normal.zig`), the pending prefix and `m` +sub-key (each the role of the key read) and a count, emitting an `Action`: the +role and what it was given (a count, a literal, `]` or `[`). The roles are +grouped by the context a key is read in and tried in their order there. The +text's executor (`executeNormalAction`) and a PDF's (`pdf_view.applyNormal`) +both switch on the role. It knows nothing about panes or text. Then it is +EXECUTED: `Key` and `handleKey` in `src/pardes.zig` (intercept order is +load-bearing, see the comment there); `handleNormal` (parses directly into +`Pane.normal`), `executeNormalAction`, `replaySels` and `multiOnce` in +`src/normal.zig`; and `enterInsert`, `handleInsert` / `insertKey`, `insertTab`, `normalDelete`, `normalYank`, `pasteText`, `normalChange` in `src/edit.zig`. Undo and redo live in `panes.File` and `panes.Terminal`. Pure text math: `src/modal.zig` (the `hx*` family is the helix-semantics layer: gap offsets + @@ -161,11 +164,11 @@ against keymap.md. Edit ops on terminal panes obey the immutable-output rule (typed runs only) — same as `d`/`c` today. `Pane.normal` holds `modal.Normal.State`: a count (accumulator, -capped 0xffff), a `Prefix` (`g` `z` `m` `f` `F` `t` `T` `r` `]` `[`), a -`MatchSub` (m-mode's `i`/`a`/`s`/`r`/`d`) and one `held_char` for `mr`'s +capped 0xffff), the prefix key's role (`g` `z` `m` `f` `F` `t` `T` `r` `]` `[` +`"`), the `m` sub-key's (`i`/`a`/`s`/`r`/`d`) and one `held_char` for `mr`'s ``. `find_op`/`find_ch` (the `Alt-.` repeat target) stay -on `Pane`, because the parser emits `repeat_find` without remembering what was -found. Pure text math in `modal.zig`: `findChar`, `matchBracket`, +on the body's `Text`, because the parser emits `repeat_find` without remembering what was +found. Pure text math in `modal.zig`: `findTarget`, `matchBracket`, `paragraphFwd`/`paragraphBwd`/`paragraphRange`, textobject/surround ranges, `replaceRange`/`replaceChars`, `changeCase`, `joinLine`, `indentLines`, `adjustNumber`, `deleteSpan`, `advanceBy` — each with inline tests that -- cgit v1.3