summaryrefslogtreecommitdiff
path: root/docs/typ/building.typ
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 07:44:55 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commit0db7861d9da09e059fa1b9e40fff5cd52add27f2 (patch)
tree6e95dfa36e07b3234b1d5cdb990b11f95c184a3f /docs/typ/building.typ
parentd3742ddf2b3a85eb3935cb35e958fa27f1293a6b (diff)
parentdee94c740bdaea61ff35b4e0a7f1d2815c9ee441 (diff)
downloadpardes-0db7861d9da09e059fa1b9e40fff5cd52add27f2.tar.gz
pardes-0db7861d9da09e059fa1b9e40fff5cd52add27f2.zip
integration: the text pane a library (pardes-editor), with the GPU move, the terminal, the plumber and the diff work
A merge of pardes-next (wmrtztwl) and editor-lib (rlumrxuq), no conflicts. Gated against the baseline of the integration line (.scratch/sketch/gpu/mbase): the merge with the library before its follow-up, in full: frame corpus 77/77 identical in Debug and in ReleaseFast, the gated window -0.019% instructions (threshold 0.5%), unit-test on gui 1584/1592 with no failure the baseline has not; this merge: corpus 77/77 in Debug, unit-test on gui 1584/1592, on tui core-test 811/950 (139 skipped), shell-test 990/993, lib-test, hxdiff 658, parity 738, hxgolf 124, hxlib 538 and its parity 618, all 0 mismatches, replicas pass. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'docs/typ/building.typ')
-rw-r--r--docs/typ/building.typ36
1 files changed, 36 insertions, 0 deletions
diff --git a/docs/typ/building.typ b/docs/typ/building.typ
index f14c466b..2b6e72b3 100644
--- a/docs/typ/building.typ
+++ b/docs/typ/building.typ
@@ -116,6 +116,41 @@ out: a cell's width is vaxis's and uucode's, and a tab is
`config.tab_width` cells wherever it stands. `test/lib` is such a
package, and `zig build lib-test` builds and runs it.
+=== The editor
+
+`pardes-editor` (`src/lib_editor.zig`) is the text pane as a library:
+helix's keys on a text kept in memory, no files, commands, builtins,
+prompts or views. A package asks for it, and is then given uucode, mvzr
+and vaxis's grapheme width besides; one that does not fetches nothing more.
+It has `pardes-syntax` in it as `.syntax`: a file belongs to one module, so
+a package imports one of the two.
+
+```
+const pardes = b.dependency("pardes", .{
+ .target = target,
+ .optimize = optimize,
+ .@"tree-sitter" = .minimal,
+ .editor = true,
+});
+exe.root_module.addImport("pardes-editor", pardes.module("pardes-editor"));
+```
+
+The editor is a value of plain data, `Editor(capacity)`: no pointer, no
+allocator, every capacity in its type, so a program keeps it where it
+keeps its state and it outlives the code that made it. Each call is handed
+an allocator it may drop afterwards (a frame's arena), runs the editor's
+own normal.zig and edit.zig, and says what came of the key.
+
+#pairs(
+ [`key`, `run`], [a key as a pane in normal or insert mode takes it, or an action the caller built: `done`, `pending` (a count or a prefix awaits the next), `unbound`, `action` (bound but the caller's: a view, `:`, `/`, `s`, a language server, a macro), or `refused` (what it made does not fit; the value is as it was)],
+ [`selectRegex`, `setText`, `replace`, `setRegister`], [what a caller does with `s` once it has a pattern, a whole new text as one step to undo, a byte range rewritten as one (or `join`ed to the step before: a drag's frames one undo), the clipboard into `+`],
+ [`read`, `bytes`, `ranges`, `mode`, `pending`, `register`], [the text, the ranges in document order and the primary, normal, insert or select],
+ [`Language`, `Syntax`], [a grammar handed in at run time (its `TSLanguage` and query sources, told by an extension), and a text's parse and colours made again when it changes; drop it at a reload. Handed to `key` and `run`, the tree-sitter walks (Alt-o and kin, `]f`, `mif`) run on it; without one they are the caller's],
+)
+
+`zig build hxlib` runs helix's cases on it against the goldens, and
+`-- --parity` against the file pane.
+
= Tests
```
@@ -135,6 +170,7 @@ zig build kitty-harness kitty graphics through a pane end to end (a fake kitt
zig build syntax-test tree-sitter tests without building the editor
zig build syntax deterministic per-byte highlighting snapshots
zig build lib-test the library, from a package that depends on pardes (test/lib);
+zig build hxlib helix's cases on the library's editor (-- --parity: against the file pane);
unit-test runs it too
zig build behaviour-test behaviour through the 9P tree, in process (test/behaviour/),
and the T1 runner's short run of random 9P requests