From b40ce1fcea232b99f28462c54cffc9fdd78abbad Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 24 Nov 2026 23:01:19 -0300 Subject: Prompt: a pipe prompt runs a known filter live, a run a selection (walk UI, pick-ui SPEC.md §7.4, item 4 of line E): `| A-| ! A-! $` from a body run the command as typed at each key when its first word is a known filter (`sort uniq tr cut sed awk jq column fmt fold rev head tail wc grep nl tac cat`), else the count says ` isn't a known filter · C-p runs it` and C-p runs it live all the same; the live run is a pipe request of its own, off the loop (Pipe.preview, out with the host as `wait` is; a later key's supersedes it, its answer then no one's), its command framed so that each selection's run says its stdout, its stderr and its status (Pipe.framed: sh, the runner's all-or-nothing answer kept as it is); counted `2 lines → 2 · exit 0`, `2 runs · 1 ok · 1 exit 2 `, `keeps 4 of 6` (`$`), `⋯` while it runs; the outputs drawn in the body as ghost lines under the lines they replace (Prompt.ghosts, renderBody's last step: the replaced lines on the diff's deleted ground, each output on the added ground, `!`'s before its selection, `A-!`'s after, the rows below pushed down; drawn, never written: R3), `A-|`'s runs a band step, each `#1 exit 0` and its output; Enter over runs that failed is refused once (` — ⏎ again applies the 1 that worked`), again applies what the live run made, the selections whose runs failed left as they were (Pipe.applyLive: pipeResponse's apply split out, a run's status its verdict), and nothing when every run failed (said, the prompt open); a command not run live, and `A-|` (its point is what it does), runs on Enter as before, one request; wire 39; THE FAULTS THE 40,000-SEED FUZZ MET (each in no code of this item, each a damaged dump's): Core.PendingWrite's `off` past its bytes (dropPendingWrite's count below zero), now a `.place`, the total saturating; the prompt histories' lines undefined past a damaged count (walk.hash read a length of 0xAAAA), now empty by default; TEST FIRST: Prompt.zig "a pipe prompt runs a known filter live, a run a selection ..." and "a live run's framing says each run's output, stderr and status in a real shell" (shell-test); Pipe.zig's tests take the request the keys made last (a known filter ran live before Enter ran it); golden pipe (the count of the live run); core-test 1018/1185 (167 skipped: the framing test wants a shell), shell-test 1232/1235, pane-test 182/184, behaviour-test 274/277 (the failures A's, as on item 1), process-test A's six and none of mine, term-test 17/17, kitty-test 45/45; the fuzz at 40,000 join and 1,779 image seeds: pass; the soak, 5 clients: diverged 0, unequal 0 at rtt 30/80/207, quiet checks 590/0 484/0 700/0, the corpus 22 scenes the same, exit 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- core/Core.zig | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'core/Core.zig') diff --git a/core/Core.zig b/core/Core.zig index e718149e..61d8c7e9 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -1399,7 +1399,8 @@ fn refillPendingWrites(p: *Pardes) void { /// may be handed to a different pane next frame. pub fn dropPendingWrite(p: *Pardes, id: usize) void { const pw = p.pending_write[id] orelse return; - p.pending_write_bytes -= pw.bytes.len - pw.off; + // (Saturating: a damaged image's total may say less than its parts.) + p.pending_write_bytes -|= pw.bytes.len - pw.off; p.gpa.free(pw.bytes); p.pending_write[id] = null; } @@ -2303,7 +2304,17 @@ pub fn appendPlacement(p: *Pardes, place: Placement) bool { return true; } -pub const PendingWrite = struct { bytes: []u8, off: usize = 0 }; +pub const PendingWrite = struct { + /// What is written held to the bytes (walk.zig `.place`): a damaged + /// image's past them freed a count below zero. + pub const replica = .{ .place = .{.{ "off", "lastOff" }} }; + bytes: []u8, + off: usize = 0, + + pub fn lastOff(pw: *const PendingWrite) usize { + return pw.bytes.len; + } +}; /// The session layouts `init` can put on screen. One name each, so choosing /// between them reads as a choice instead of a chain of ifs over four options. -- cgit v1.3