diff options
Diffstat (limited to 'docs/next-terminal.md')
| -rw-r--r-- | docs/next-terminal.md | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/docs/next-terminal.md b/docs/next-terminal.md index 2a8b61c3..26996897 100644 --- a/docs/next-terminal.md +++ b/docs/next-terminal.md @@ -22,7 +22,7 @@ Phase 2 (the terminal on the addon C ABI) and Phase 3 (shipping it as a `.so`) a ## What "leaner" means -"The core" is the `core_module` in build.zig: `src/pardes.zig` and everything it reaches. It is what `core-test`, hxdiff, perf, the benches and the test runners are compiled from, about 15 artifacts, each its own compilation. +"The core" is the `core_module` in build.zig: `core/root.zig` and everything it reaches. It is what `core-test`, hxdiff, perf, the benches and the test runners are compiled from, about 15 artifacts, each its own compilation. **Today `wireCore` (build.zig:835) gives it:** - cloud9, uucode, mvzr, xitdb, zstd; @@ -107,11 +107,11 @@ Items 1 and 3 were tried and reverted by the user's ruling (2026-11-16, "just ke - The undo of the edit copy is the core's, so its type moves to its user. This also clears the way for `pardes-editor` (the text library, reports/editor-lib.md:313). - Gate: core-test and hxdiff. -After 2 and the pager's move behind the interface, ghostty-vt is imported by the terminal's own files alone (terminal.zig, screen_state.zig, TerminalImages.zig, and the pager's parse in src/term/). +After 2 and the pager's move behind the interface, ghostty-vt is imported by the terminal's own files alone (terminal.zig, screen_state.zig, TerminalImages.zig, and the pager's parse in core/term/). ## Phase 0: the narrow module (no behaviour change, no ABI) -`src/term/` takes: +`core/term/` takes: - terminal.zig (3,422 lines); - screen_state.zig (1,664); - echo.zig (834); @@ -119,7 +119,7 @@ After 2 and the pager's move behind the interface, ghostty-vt is imported by the That is about 6,300 lines moved, not rewritten. -The rest of the core calls only the functions of one interface file. Its records are plain data: rows, numbers, bytes to write, cells. `src/Term.zig` is the suggested name: the core declares the interface and the module implements it. +The rest of the core calls only the functions of one interface file. Its records are plain data: rows, numbers, bytes to write, cells. `core/Term.zig` is the suggested name: the core declares the interface and the module implements it. **Today the core calls 62 terminal functions** (outside tests, by grep). They shrink as follows: @@ -156,7 +156,7 @@ The ptys stay host resources: ## Phase 1: the module leaves the core module - **The module.** - - `term` is a Zig module of its own, rooted in `src/term/`. Its imports are `std`, ghostty-vt, wuffs, zstbi, uucode and the interface module. + - `term` is a Zig module of its own, rooted in `core/term/`. Its imports are `std`, ghostty-vt, wuffs, zstbi, uucode and the interface module. - It does not import `pardes`. Zig refuses a file outside a module's root, so the build graph enforces the seam in both directions: the core cannot name ghostty, and the terminal cannot name the core. - The records the terminal writes (cells, placements) live in the interface module, or in a leaf module surface.zig's types are moved into. surface.zig today imports `pardes.zig` (surface.zig:3), so its cell types have to be lifted out. - **Registration.** @@ -183,20 +183,20 @@ The ptys stay host resources: What differs from the plan above, and why: - **The ops are a compile-time constant, not handed over at start.** - `Term.ops` (src/Term.zig:18) is `&@import("term").ops` when the build's + `Term.ops` (core/Term.zig:18) is `&@import("term").ops` when the build's `term_options.terminal` says the core has a terminal, null otherwise. Every core module but core-test's is given `term`; core-test's (`core_lean` in build.zig) is not, and its `term_options` say so. A run-time `Pardes.Options.terminal` would have put the table in every test's options and every host's start for no gain: no build ever has two terminals, and a null known at compile time drops the dead code. -- **The table**, `plain.term.Ops` (src/plain/term.zig): about 60 entries +- **The table**, `plain.term.Ops` (abi/term.zig): about 60 entries in the groups of Phase 0's table (lifecycle, output and view, input, prompt, text, the pager, draw, replicas), each taking and giving plain records or one of four opaque handles (`State`, `Encoder`, `Track`, `Replica`). The module fills it through a cast refused at compile time - unless each entry's signature matches (src/term/term.zig). -- **`Term.State` is a small struct around the handle** (src/Term.zig:55), + unless each entry's signature matches (core/term/term.zig). +- **`Term.State` is a small struct around the handle** (core/Term.zig:55), not the handle itself: walk.zig allocates a pane's terminal on load and hooks its digest and dump, and needs a type of the core's to do it on. The dump keeps a terminal as before (its `Parts` by name, then ghostty's @@ -205,7 +205,7 @@ What differs from the plan above, and why: name on load, so dumps of either build load in the other (checked: test/daemon.py --upgrade from a build of main, fc38c73c5, and from the Phase 0 base into this one, and from this one back to main's). -- **Predicted echo came back to the core** (src/echo.zig): it is the +- **Predicted echo came back to the core** (core/echo.zig): it is the replica's presentation, and reads the emulator through five entries (`grid`, `modes`, `prompt`, `echoCell`, `markRead`). - **The draw group is plain data** (Phase 0 left it typed in the core's @@ -213,10 +213,10 @@ What differs from the plan above, and why: the view's rows the body shows (painting the whole view cost a frame of the perf harness's `render` 82 -> 127 µs: a 3-row pane over a terminal still 37 rows tall, until the next update resized it), the - core lays it over the body (src/ansi.zig), and `Term.images` gives + core lays it over the body (core/ansi.zig), and `Term.images` gives placements. The colour filter stays the terminal's, as it wraps ghostty's `generate256Color`. A finished command pane's diff colours - (`DiffOutput`, `recolorDiffOutput`) moved beside it in src/ansi.zig. + (`DiffOutput`, `recolorDiffOutput`) moved beside it in core/ansi.zig. - **The no-terminal core** boots a scratch pane where a shell would be (Core.zig, `initSession`). `Term.open` refuses with `error.NoTerminal`, which a word says as "no terminal in this build" (`Term: …`, `exec: …` |
