From 280306ed779368d7e20e9678eca45e4b81e0ccbf Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 26 Nov 2026 03:03:20 -0300 Subject: Pick, Kind, look, draw, mouse: a picker previews a file an addon's kind takes through that kind in the pane it lands in, a binary no kind takes as one line naming it, and Enter on such a row lands as a Look does, never the file's bytes as text (the user: "the file preview wasn't working for images (maybe pdfs too? Didn't test)", "It should be a generic logic for addons btw, and I saw the bytes rendered as ascii"; the coordinator's W7 under SPEC principle 2); REPRODUCED with the installed build (install74, the S kit, 26 px): SPC f f from a reading main.zig, the cursor on photo.png left main.zig in the body (the previous row's file), on paper.pdf showed `%PDF-1.7 %âãÏÓ 1 0 obj …` as text (a PDF has no NUL in its first 8000 bytes, so Pick.preview's binary guard let it through), and Enter on photo.png put `�PNG … IHDR …` in the reading pane: THE BYTES-AS-TEXT PATH the user saw: Pick.land → look.open → walk → Trail.step → Trail.show → File.open, which reads any path as a text (look.resolve sends a typed or clicked `photo.png` to Kind.openFile, but look.open, every jump's way, had no kind route); THE FIX: look.open routes a path a kind takes (`kinds.forPath`, the routing resolve uses) to openKind, lookAt's kind branch made a function (the pane of it focused, else opened and placed as a Look places it), so a picker's Enter, the Walk queue and a held pane's step land as a Look; Find's row of a kind's file is the file whole (a place in it is its kind's address: line 1 made the image refuse it); Pick.preview: a file a kind takes is shown by a slot of that kind over the landing pane's text (Kind.newSlot, split from Kind.open; Pick.showKind), which stays under it unseen until the next row or the roll-up closes the slot (putBack, restore: Esc exact, nothing left), no per-kind code; any other file with a NUL is one read-only line, `blob.bin · binary · 3.0 kB` (Pick.nameLine); until the kind draws (its paint places nothing yet) the body shows `photo.png · image · 24.8 kB` (draw.zig; Kind.draw says whether it painted); a refused one is that line with its kind's why; the kind does its own work as for its pane (the image decoded on a worker); only the row the cursor rests on at a frame opens (the preview's existing tick rule), and a draw of a row passed by is dropped when it lands (Kind.Slot.drawn_from: this process's draw count when the slot was made; Kind.deliver drops older answers, which went to the next slot of the same kind on the same pane); a previewed kind says, looks at, runs and lists nothing (Kind.Call.end returns before them while Pick.previewing) and takes no mouse (mouse.kindMouse); RUN (TEST FIRST): test/behaviour/addons.zig, four tests through 9P with the fake addon (addons/fake: no kind code in Pick) and the image addon, and addons_pdf.zig one with the pdf addon: a `.fake` file previews as the fake's paint (`count 7`) and not its bytes, Esc puts the screen and /index back, Enter opens the fake's pane with the reading pane's text kept; blob.bin's one line, never other.txt's text after it, a kind's paint after the binary's; three pictures, two rows down with no frame between: one draw held per rested row (2, not 3), and the rested picture shown after the passed one's answer came last; Enter on a picture opens the image pane, the reading pane `the notes`; a PDF's pages as pictures in the landing pane, none after Esc; Session.tick (a host frame) added, as previews wait for the frame after the key; on the base they fail (the bytes `1234567` shown, no line, no image pane, `%PDF` on the screen): core-test 1128/1301 (173 skipped; the kept_out list names Kind.Slot's drawn_from and size), shell-test 1349/1352 (3 skipped), pane-test 183/184, behaviour-test 285/285 (+5) and --replay 285/285, process-test 0 of 147 failed (3 skipped), term-test 17/17, kitty-test 45/45; the gui unit-test on the stack's top (W8); no dump change (the two Slot fields are local, out of the digest and the dump); the S kit with this change's Debug gui at 26 px: the PNG and 9p.pdf previewing in the landing pane, blob.bin's line, Enter on photo.png an `img` pane with main.zig kept (.scratch/walkui/W78/png a02-a05, before r03 r05); no frame or perf gate (the user's rule of 2026-11-26); load 3.7 to 10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE --- test/session.zig | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/session.zig') diff --git a/test/session.zig b/test/session.zig index d437ecf2..13798753 100644 --- a/test/session.zig +++ b/test/session.zig @@ -316,6 +316,14 @@ pub const Session = struct { return true; } + /// A frame of the host's loop (its tick): what waits for the frame + /// after the keys that asked it is done (a picker's preview of the row + /// its cursor rests on). + pub fn tick(s: *Session) void { + pardesOf(s).update(.tick); + s.drain(); + } + /// Kinds' jobs and draws held from now on (`hold_jobs`), until /// `releaseJobs`. pub fn holdJobs(s: *Session) void { -- cgit v1.3