From 29ac9be75fdcafbd7d05c15aa9eb8490d74caa98 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 26 Aug 2026 18:58:37 -0300 Subject: An edited row keeps its colours, four copies of forkShell become one, and Esc stops recentring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## A terminal row's ANSI colours survive being edited The loudest colour bug this editor had: one keystroke anywhere in a coloured shell row turned EVERY column of it grey. `EditAnchors` anchored a buffer line only when it was BYTE-IDENTICAL to the shell row it stood over, so a single differing byte dropped the whole row's colour projection. Worst shape is invisible: append past the pane's right edge, where the text is clipped, and the row looks the same and only its colour goes. Anchoring is byte-level now. An edit leaves the row's own bytes at both ends, and being the same bytes they keep the same colours; only what was typed has no cell under it, so only that takes none. Live, on real `fastfetch`: a 32-column blue run split into 6 + 26 around one typed character. Three defects underneath it, all found by machinery rather than by reading: * A JOIN removes a buffer line while the buffer's covered span grows, so `lines == covered` and both aligned guesses — Nth line over the Nth covered row, and the same counted from the bottom — resolved to the SAME wrong row. Every untouched row below a join went plain. Anchoring is now a streaming monotone matching: one shell-row cursor that only ever moves forward, advanced once per buffer line, linear in the buffer where the version before it was quadratic. * An EMPTY line is not evidence. Splitting a row makes one, it equals every blank row in the span, and left free to look ahead it claimed the blank row below the last output and took every coloured row in between out of reach of the lines that owned them. * Reflow under a scrolled viewport. `PageList.getTopLeft(.viewport)` returns the viewport pin verbatim, x and all, while `PageList.pin` forces x to 0 — so after a reflow remapped a tracked pin into the middle of a row, the text pass dumped row 0 from that column while the colour pass paired the fragment with the row's FIRST cells. Row 0 wore its left half's colours until the pane snapped back to live output. `bodyText` dumps from column zero now, which is also what ghostty's own renderer draws. Also here: DECSCNM (reverse video) was silently dropped whenever `tty_filter` was off, because the raw path resolved a `.none` colour by role and never consulted the mode. The test that found the first two is the one worth keeping: random editing against an ABSOLUTE oracle — every row's own text names the colour it must have — because the differential oracle it replaced was blind by construction. It skipped the edited row, which is the row the user is complaining about. ## Esc returns to a pane without moving its view Esc in body normal mode runs `Last`, "the pane you were in before this one", and that went through `focusPaneLine`, which recentred a file on the target line unconditionally. So returning to a buffer repainted the whole screen to show a line that was already on it. `focusPaneLine` takes a landing now: `.center` for the three callers going somewhere you have not been (a look target, a path a pane already holds, `@pN:LINE:COL`), `.keep` for Esc. `.keep` leaves the view alone and lets `ensureCursorVisible` — which already existed and already scrolls by the minimum into the `scroll_off` band — be the only thing that may move anything. Not `line = 0`, which `focusPaneLine` already understands as "focus and touch nothing": a background pane's view can move while you are away, because the wheel scrolls the pane under the POINTER and a resize reveals no cursor, so the recorded cursor plus a minimal nudge is what actually gets you back. Ctrl-o and Ctrl-i keep centring, and the asymmetry is structural rather than arbitrary: `Last` only ever CROSSES panes, so the pane it lands on already holds the view you left it with, while `jumpBy` can land in the SAME pane, where a long in-file jump would arrive on the very top or bottom row with `scroll_off` lines of context on one side. Helix splits the same pair the same way — its jumplist centres, its buffer switch does not. One deliberate consequence: under `.keep` a PDF's page is not restored AT ALL, because a page reveal IS that pane's view and a reveal of the page you are already on still snaps `document_scroll_y` to that page's start, discarding where you had read to. When something moved the pane while you were away — the wheel again — Esc leaves it where the wheel left it, and Ctrl-o is how you reach the recorded page. ## host_io.zig: the machine-local half of a host, once `host.zig` is the seam. The part of the answer that is identical on every host with an operating system under it — fork a pane's shell, put bytes on a disk — was written FOUR times: in tty.zig, gui.zig, macos.zig and detached/server.zig. What those copies had in common says what they were for: all four were missing FD_CLOEXEC on the pty master, so in every shell pardes has shipped, a program in one pane could read another pane's terminal. One copy now, and the wire got smaller for it: `ServerMsg.spawn` is gone. A frontend never asked the server to fork anything — the server has an operating system under it and forks through `host_io` like every other host — and `decodeClient` lost the scratch buffer that message needed. --- docs/web.md | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) (limited to 'docs/web.md') diff --git a/docs/web.md b/docs/web.md index 0f8c068f..dfbc295d 100644 --- a/docs/web.md +++ b/docs/web.md @@ -37,14 +37,18 @@ core ticks, so 120/144 Hz displays do not accelerate frame-count transitions and a returning background tab has bounded catch-up work. The `web` platform is deliberately not one of the shader-capable native GUI -shells. It exposes no `Panel*` transition builtins (`PanelSlide`, `PanelZoom`, -`PanelDissolve`, `PanelAscii`, `PanelVertical`, `PanelEdges`, `PanelFall`, -`PanelWave`, `PanelCurtain`, `PanelScramble`, `PanelType`) and no -`Crt`/`Ripple`/`Glitch`: applying those faithfully -would require a second canvas renderer and give up the DOM renderer's -selectable/accessibility contract. Theme fades and the delayed, -side-effect-free Look hover remain grid animations and continue to use the -fixed 60 Hz ticks above. +shells, and two comptime capability flags say so once each. It exposes no +`Panel*` transition builtins (`PanelSlide`, `PanelZoom`, `PanelDissolve`, +`PanelAscii`, `PanelVertical`, `PanelEdges`, `PanelFall`, `PanelWave`, +`PanelCurtain`, `PanelScramble`, `PanelType`) because +`capabilities.panel_transitions` is `pardes.hosted`, and no +`Crt`/`Ripple`/`Glitch` because `capabilities.scene_shaders` is +`platform == .gui or platform == .macos` (`src/builtins.zig:41-42`; the words +themselves carry those availabilities in `src/runtime_config.zig:155-168`). +Applying either faithfully would require a second canvas renderer and give up +the DOM renderer's selectable/accessibility contract. Theme fades and the +delayed, side-effect-free Look hover remain grid animations and continue to use +the fixed 60 Hz ticks above. Build a replay from a dump: @@ -60,10 +64,12 @@ The output is in `zig-out/web`. Serve that directory over HTTP; browsers do not allow a useful WASM module load from `file:` URLs. The browser shell has no argv: every command-line flag `src/main.zig` parses — -`--tty`, `--tty-toggle`, `-n`, `-l`, `--nested`, `-h`, and the positional -file-or-directory — is native-only, because the wasm module roots at +`--tty`, `--tty-toggle`, `-n`, `-l`, `--fs[=]`, `--nested`, +`--detach[=]`, `--attach[=]`, `-h`/`--help`, `--version`, and the +positional file-or-directory — is native-only, because the wasm module roots at `src/web.zig` and never links `main.zig`. State comes from the embedded dump -instead. +instead, and there is nothing here to answer `--version` with even though +`pardes.version` and `pardes.commit` are compiled in like everywhere else. Web LOOK's source archive follows Git's working-tree view: tracked `.zig` files plus new, nonignored ones, sorted by path. The checked-in browser replay is a @@ -77,10 +83,18 @@ against the build-generated source archive rather than disk, and no language BACKEND is compiled in (`zls_backend` is off for wasm — which also means `lsp.supports` is empty, so the core never even raises a language query there, and the host leaves `lsp` null). + Replay terminals retain the same core shape but use Zig's failing IO value; this keeps the module freestanding without instantiating POSIX threaded IO that the browser can never call. +`Attach` and `Detach` are absent for the same structural reason and behind the +same gate: both are `enabled = pardes.hosted` (`src/builtins.zig`, and +`pardes.hosted` is `tty or gui or macos`), because a detached session is a unix +socket and a page has none. Nothing in this shell speaks +`src/detached/wire.zig`, and `push_detach` is one of the null vtable methods +below. + `src/web.zig` fills in six methods of `Host.VTable` and leaves the rest null, and a null method is answered by the core itself rather than forwarded to a page that could not honour it. The six are `present`, `write_file`, @@ -102,8 +116,12 @@ against the core's virtual filesystem, which is also where every read comes from — the core reads files itself and never asks a host; `watch_file` records the request; `lsp` answers an empty row set at once (`zls_backend` is off for wasm, so the core never raises a query there anyway) and `pipe` answers -failure; `wait_input` is null because wasm must never block, and `theme_file` -and `dump_themes` are not reachable without a config directory. `quit` sets the +failure; `wait_input` is null because wasm must never block, and `watch_theme` +and `dump_themes` are not reachable without a config directory. Of the +remaining nulls, `post_present` and `poll_frame` are per-frame host bookkeeping +a page has none of, `detach` has no session to leave, `gpio_toggle` belongs to +the ESP32-P4 board, and `fs_reply` answers a FUSE control filesystem that +`--fs` is the only way to ask for. `quit` sets the core's flag, which `pardes_should_quit` reports so the page can stop its frame loop. -- cgit v1.3