summaryrefslogtreecommitdiff
path: root/src/tui
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-18 08:29:46 -0300
committerGabriel Schneider <[email protected]>2026-11-18 08:29:46 -0300
commit5c5e0102f92938f433a3465c92818be810c1ef78 (patch)
tree379cf5e47f2e281934236482d7a5f78db732b18b /src/tui
parent8640d280ebc48b0d2658aa13bee2f9ad933c39f3 (diff)
parent3350156db428656fa8e583d1971663e1c4a215b0 (diff)
downloadpardes-5c5e0102f92938f433a3465c92818be810c1ef78.tar.gz
pardes-5c5e0102f92938f433a3465c92818be810c1ef78.zip
integration: the client path's round 1 (the tty client drawing as the own terminal does, a detached session's deltas a unit a frame, the window client's wait, pardes-gui --detach as pardes) with addons in a client part 2 (a draw, ABI 3.2; the image kind where it is shown): no conflict; tui core-test 819/958 (139 skipped), shell-test 993/996, behaviour-test 273/273, replicas pass, pane-test 180/181; the window's suites and its frame corpus NOT run on this merge yet (disk)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/tui')
-rw-r--r--src/tui/tui.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tui/tui.zig b/src/tui/tui.zig
index 7cc45e25..5714ea0c 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();
@@ -1074,6 +1076,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).
@@ -1853,6 +1857,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;
@@ -2224,6 +2230,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);