# Changelog ## Unreleased - An experiment, behind `PARDES_PAIR=1` until it is the default: `pardes FILE` in a terminal and `pardes-gui FILE` fork a session with no frontend of its own and are its first client. Such a session is kept (started with `new --detach`, or a Detach typed in any client since) or not: closing a client's window or terminal, or a TERM to it, ends a session not kept when that was its last client; a client killed outright leaves it running. `pardes ps` says `(tty, kept)` or `(tty)` of it. Without the variable nothing changes, but a terminal client (`pardes attach`) ended by a TERM now says goodbye and exits 0, its terminal put back, where it died of the signal. - `pardes new --detach[=NAME]` returns once the session runs (registered and listening), printing its name, exit 0; the session runs on in a session of its own. `pardes --detach=NAME` without `new` is still the session itself, until it ends. - `pardes attach NAME` (and `pardes-gui attach NAME`) is always a client: a process of its own with its own view, whatever the session was started in. A session's own terminal or window is only the one it was born with: once a Detach or its terminal let it go, it never takes one back. Before, an attach to a detached terminal's session handed it this terminal (the attach waiting as its stub), and `pardes-gui attach` asked a detached window's session to open its own window again and exited 0. A client's Detach ends it with "detached from 'NAME', which is still running" and exit 0, as the stub's did (the session's last word on a link, `left`); a session's end, with its code (`ended`). Bare, `pardes attach` takes the one detached session, else the one session, of either kind; with several it names them all. - A session whose daemon was killed starts the next one itself and registers with it again, its shells' terminals and its clients with it: `pardes ps` lists it, an attach and Adopt find it, and Detach works. It ran on unlisted for good before, and its terminal closing ended it. - The words `pardes` says at a Detach name `pardes attach NAME`, the command's spelling now, not `--attach=NAME`. - On a client, and so on a far one, what changes only the editor is applied at once and only what touches the session's machine waits for it (a save, a shell's keys, a file read from disk, a program run, a kind whose state is the session's). Collapse, Newcol, Joincol, a window resized and a pane's grip dragged beside a shell, Del and Zerox of a file's pane, a yank to the clipboard, ClipPaste, a Theme after a ThemeFile and a key that starts an addon's job each waited a round trip and no longer do; nor does a click into or out of a shell whose program asked for focus events, which hears of the focus a round trip after it shows. - A client's yank to the system clipboard (`"+y`, ClipYank) fills the clipboard of the machine the client runs on, ClipPaste pastes that clipboard, and a link a client looks at opens there; all three went to the session's machine. - `n` and `N` in a kind's pane (+Search, references, errors) step to the places its rows hold, at once, and no longer stop on a bare word of a command's output that names a file. - On a client, `~`, the default shell, a word run in the session's directory, `Font`, `Fonts` and DumpDir's check of its directory are the session's machine's, where a client's own step read its own machine and could part from the session. - An idle client and its session stay idle: a client's quiet check, once answered, asked again 300 ms later for ever, waking both processes three times a second. - A pardes that starts while another, still running, loads an addon no longer takes that load for a crash: a client starting while its session loaded the same game listed it `skipped: it crashed its last load`, and every key into the game waited for the session, until `Addon load`. - A search pattern that stops inside a count or an escape (typing `a{2}` or `fn main() {`, `a{1,`, `\x`) no longer takes a safe build down, nor in a fast one finds what the bytes after it made of it: it is a pattern that does not compile, found as the characters it is. A class escape holding a lone non-ASCII byte no longer loops without end, and a half-typed pattern that does not compile (`(`, `[`) no longer leaks. - A client no longer diverges and joins again after a press on a notice's chip, or a click in a big markdown text's table, in a view whose frame it had not drawn; a big text's tables are read whole when it opens (18 ms for 2.7 MB of tables), where they were read 4096 lines first, then 4 ms a frame. - A client no longer crashes when another's input rolls back its own Del of a pane whose kind's state is not plain, nor drawing a closed terminal with a kitty image it brought back (`Look @pN`) under a rollback. A kind's picture drawn for a pane closed meanwhile is let go, where it was kept for the session's life; `pardes help` with no session running no longer crashes now and then, freeing its own core while still answering it. - The tag word `Unattach` is `Undock`: a +Search docked under the pane it answers for leaves it with `Undock`, and stays where it is, a pane of its own. *Attach* is a client joining a session now; `Unattach` is an unknown word, with no alias. - The row after a file's last newline, where the cursor can sit and no line is yet, shows `~` in the gutter where its line number was, as helix's does. - `pardes` has commands, and they describe themselves: `ps`, `attach`, `kill` and `new` for sessions, `do WORD` and `words` for the builtins, `fs ls|read|write|ask|follow|stat|help|complete PATH` for the tree (a refusal in the session's own words, where a mount says EINVAL), and `help`, `completion bash|fish|zsh`, `skill` and `version`. `pardes help` is a map of them; `help CMD` ends in examples; `help WORD` and `help PATH` print what the session's /commands and /README say, and with no session running, what a core made in the command's own process says. A command acts on `-s NAME`, else `$PARDES_9P`, else the only session. `pardes FILE` and every flag work as before; `--ps`, `--attach`, `--kill`, `--kill-all`, `--help` and `--version` are the commands' old spellings, for a release. A file named like a command opens as `./ps`. The reference's "The pardes command" is `pardes help --all`, written by `zig build builtins-json -Dplatform=tui`, and a test says when it is stale. - The text pane is a library too, `pardes-editor` (`core/lib_editor.zig`, docs/next-editor.md): helix's keys on a text kept in memory, for a program that draws it itself (a sketch with a language of its own). It is a value of plain data, every capacity in its type, copied anywhere and outliving the code that made it; each call runs pardes's own normal.zig and edit.zig on it, built with no pane and no core, and hands back what is not the text's (a view, `:`, `/`, `s`, a language server, a macro) to its caller. A grammar can be handed in at run time beside the compiled-in ones. A package asks for it with `.editor = true`; one that asks for `pardes-syntax` alone fetches what it did. `zig build hxlib` runs helix's cases on it, against the goldens and against the file pane. Nothing a session does changes, and a session dumped before loads after. The caller can hand it the parse it keeps (`Syntax`), and helix's tree-sitter walks (Alt-o, Alt-i, Alt-n, Alt-p and kin, `]f`, `mif`) run in the library on pardes's own functions, Alt-i going back the way Alt-o came; `replace` rewrites a byte range as one step to undo, the ranges following, and a drag that rewrites a number every frame can join its frames into one. A new line's indent comes from that parse where its grammar has an indent query (a `Language`'s `indents`), as a file's does from its own, so a language whose lines end in `)` is not pushed a level in at every line. - The terminal is a module of its own (`core/term/`: the emulator, its screen state for replicas, kitty images, the pager's parse), which never imports the core and is reached through one table of plain-data entries, `core/Term.zig` the core's side (docs/next-terminal.md). Editing a terminal's text is the core's, on a copy of its rows, as before, and predicted echo stays the core's; nothing a session does changes, and a session dumped before loads after. `zig build core-test` builds the core without the terminal (no ghostty, no C++): a shell boot is a scratch pane there and a test that needs a terminal skips; `zig build shell-test` runs the same tests with it. - A diff paged (`git show | pardes -`) is a plumbing message, as acme's `plumb -i` sends what it shows: `type text/x-diff` to `edit`, which a default rule makes `showdiff`, its +Pager stacked in a +Diff as before. Take the rule out and the +Pager stays as text; a program reading `plumb/edit` sees the diff. The `edit` port shows any message's data with `action=showdata` (stacked with `showdiff`). - A port the plumbing rules name is a file a program reads, `plumb/`, as Plan 9's plumber serves one: every open reads its own copy of what is sent there from then on (`cat plumb/edit` sees each file a look opens), a read held until a message comes. A message to a port no one reads runs its rule set's `start`, or with `plumb client` waits for the port's first reader. - A look asks the plumber first, as acme's does: once the pane's own readings are done and a name already open in a pane is focused, what is looked at is sent (`type text`, `src pardes`, `wdir` the pane's directory), and only what no rule set takes is Look's own. The default rules keep every look as it was: the browser for a URL, a bare `.diff` or `.patch` stacked in a +Diff, `git show` of a commit hash in a git work tree are now rules of `core/plumbing`, no longer written into Look. `Diff` takes a file or a revision (`Diff fix.patch`, `Diff 3f2a9c1`), and a rule's Diff that cannot declines, so the look goes on. `Plumb` opens your plumbing file (`/plumbing`, `include basic` until you save one), read at start and applied when saved; the one-line `Plumb suffix .svg to image` rules are gone, refused in words (write a rule set: `data matches '.*\.svg'`, `arg isfile $data`, `plumb to image`). A program a rule starts runs detached, as Plan 9's plumber starts one, with no pane; a failure to start it is said. - A search with a class whose range ends at `\xff` (`[\x80-\xff]`, in an address, `s`, a plumbing rule) no longer takes the editor down: mvzr counted the range past a byte's end. - The plumber, Plan 9's, is in the session: `plumb/rules` holds its rules in plumb(6)'s language (rule sets of `object verb arg` lines, variables, `include`, `matches` over the whole text or around a click, `isfile` and `isdir` finding a name as a look does), and `plumb/send` takes a message and sends it where they say, to a port pardes reads (`edit`, `web`, a loaded kind) or to a word or command started, with Plan 9's words when it cannot. A session starts with `include basic`, pardes's rules (`core/plumbing`). Kept in a dump. `$1`-`$9` are refused, the regular expressions having no submatches. - A query pane's row looked at on its address (its gutter) opens the row's place however the look arrives, as a click there always did: an empty look written back to the pane's `event` file, and the whole row written to its `look` file, now take the address the row holds, not a word of its text. A diff's lines answer all three ways through the same one function (`look.rowAddressAt`). - Each pane's directory over 9P has a `rows` file: a line a body row of a results pane (+Search, +Callstack, +Diff, a language server's list), where it points (`path`, line, column, the address's end, where its code starts) and how it is coloured (runs of `keyword`, `string`, ... and the grounds `add`, `del`, `emph`, `line`), so a 9P client reads their addresses as data, not by parsing the text. A write at offset 0 replaces a pane's rows, a later one adds to them; rows its text cannot hold are refused. An edit drops them, as before. The editor's own producers set rows the same one way. - A drag draws no guide lines: no dashes where a pane or column would land, no rail for a carried column, no dashed seam under a pane rule held. The line between two columns no longer resizes them (nor, at a pane's corner, the panes too): a press there is a press in the pane. A column resizes by its box, left of its tag; a pane by its own box, or in a window by the rule above it. - An edit to the core recompiles it about 2 s sooner again (`core-test`, 16 % fewer of the compiler's instructions, 4.4 MB less code in a Debug test): a load's note on a field (another build's dump) is written from the type's and the field's names at run time, where every type and field had its own copy of the code that writes one; one byte dump's reader serves a session, a pane and the rest, where each had its own; and what tells a replica's build from another's (`wire.semantics`) joins its two long parts on, and the tape's shape writes its numbers itself and copies each line it builds once, where it formatted them and copied the line again for each piece, at every compile. - An edit to the core recompiles it about 3 s sooner (`core-test`, 13 s to 10 s): the build keeps each grammar's highlight patterns that pardes colours once, where every compile of every program that takes the core did it again, a quarter of its time. A package that depends on pardes is given the same filtered queries. - The 256-colour palette Petscii art and the window draw a palette colour with is pardes's own (`colors.xterm`), ghostty-vt's default to the entry. - Commit patches open as `+Diff-` and reuse only their own commit's pane, so another paged patch no longer replaces one already open. - zstbi is upstream's again (zig-gamedev/zstbi, its main): the fork pinned for Zig 0.17 was deleted, and a fresh checkout could not fetch it. - pardes's syntax is a library: a Zig package that depends on pardes is given the `pardes-syntax` module (`core/lib_syntax.zig`), with the grammars, highlighting, declarations, syntax tree and themes as the editor has them, for a program that draws source text itself. Every dependency but tree-sitter's runtime is lazy in the manifest, so such a package fetches the runtime and the grammars of its `grammars` set and nothing else; `zig build consumer-test`, which `unit-test` runs, builds one (`test/consumer`). The markdown grammar is pinned by its commit: its branch has moved, and a fresh checkout could not fetch it. - Enter, `o` and `O` give the new line helix's indent where the file's grammar has an indent query (bash, C, C#, C++, Clojure, CSS, Elixir, Fortran, Go, HTML, Java, JavaScript, JSON, Kotlin, OCaml, PHP, Python, Ruby, Rust, Scala, Zig), from the file's syntax tree; elsewhere the line's indent as before. Enter between a pair (`()`, `[]`, `{}`, quotes) puts the closer on a line of its own and the cursor on one a level in. A closer typed on its own line stays where it is typed, as in helix. - A session's end (`Exit`, the last pane's `Del`, its terminal or window gone) leaves a slim dump in the state file: its panes with their files, directories and places, not a clean file's text, an undo history or a terminal's screen. `History` (`SPC f h`) lists the state file's dumps in a `+History` pane, each as the command that brings it back, `Restore