diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-18 05:32:59 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-18 05:48:26 -0300 |
| commit | 3f8f66643a1e4840e1cbf0d7a4c5aa8580360ac7 (patch) | |
| tree | acb0c305ed07e229725bfa677d92691a9c4e92fd /src/tui | |
| parent | 22b5ada4c099618e72af3d33dc274a7c272dd227 (diff) | |
| download | pardes-3f8f66643a1e4840e1cbf0d7a4c5aa8580360ac7.tar.gz pardes-3f8f66643a1e4840e1cbf0d7a4c5aa8580360ac7.zip | |
kinds: a draw (pa_api.draw, ABI 3.2), a kind's job whose answer feeds its pictures alone: job_run over a copy of its input on a worker of the process that shows the pane (the frontend's workers through Kind.drawer, else at once), its answer to job_done with a PA_DRAWN token at the pane's next paint (Kind.deliver), never an event, on the tape, in the digest or sent to another process, each process asking its own from the same call; the header says what a kind promises by it (what job_done keeps of it paint alone reads; never a plain kind's block, nor its token; Debug checks the block is as it was) and addon.zig has draw; a client's pane of a plain kind closed in a speculation leaves its kind's own memory be (its rollback brings the pane back); the window client takes its queue's draws; the addon ABI tests expect 3.2; tui core-test 819/958 (139 skipped), shell-test 993/996, behaviour-test 273/273 (the four addon tests the base failed on its ABI string run again and pass), --replay 20 seeds 0 failures, pane-test 180/181, replicas pass, addon-test 1/1
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/tui')
| -rw-r--r-- | src/tui/tui.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tui/tui.zig b/src/tui/tui.zig index 919eeded..3938c854 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -737,6 +737,8 @@ pub fn runClient(init: std.process.Init, opts: pardes.Options, path: []const u8, .client = &client_link, }; + pardes.Kind.drawer = .{ .ctx = &sh, .go = Shell.draw }; + defer pardes.Kind.drawer = null; try startInput(&loop, &screen); defer stopInput(io, &screen.thread); (try std.Thread.spawn(.{}, winchWatch, .{&loop})).detach(); @@ -1073,6 +1075,8 @@ fn localSession( const host = sh.host(); core.host = host; + pardes.Kind.drawer = .{ .ctx = &sh, .go = Shell.draw }; + defer pardes.Kind.drawer = null; // An upgraded session's terminals, its own again. if (comptime !builtin.is_test) if (upgrade.resumed) |*rec| sh.resumeTerminals(rec); // Nobody to see it, and nobody to size it: `size` sets it (ctl.zig). @@ -1831,6 +1835,8 @@ const Shell = struct { .kind_job => |j| { s.job_tasks.finish(s.io, j.id); j.land(core); + // A client's draw done: its frame is its own to draw again. + if (s.client) |cl| cl.link.dirty = true; }, } return false; @@ -2202,6 +2208,16 @@ const Shell = struct { pardes.Stream.runHere(s.core, gen); } + /// A draw (api.draw) on a worker, as a job is. + fn draw(ctx: ?*anyopaque, j: *host_io.KindJob) bool { + const s = of(ctx); + return (s.threads_ok or s.client != null) and host_io.KindJob.go(s.io, &s.job_tasks, j, s, struct { + fn deliver(c: ?*anyopaque, k: *host_io.KindJob) void { + of(c).loop.postEvent(.{ .kind_job = k }) catch k.drop(); + } + }.deliver); + } + fn job(ctx: ?*anyopaque, pane: u8, serial: u32, token: u32) void { const s = of(ctx); if (!s.threads_ok) return host_io.KindJob.runHere(s.core, pane, serial, token); |
