summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-30 16:52:24 -0300
committerGabriel Schneider <[email protected]>2026-10-30 17:40:51 -0300
commit5925ddbe1aa39a64b484b68a8ddb3649b3d180e4 (patch)
tree487fad3a79d3efa2d2a3a8fd236c083f42171447 /src/pardes.zig
parentd92ea9dfdd9198b69bff420c3b594f0ffed1e1bb (diff)
downloadpardes-5925ddbe1aa39a64b484b68a8ddb3649b3d180e4.tar.gz
pardes-5925ddbe1aa39a64b484b68a8ddb3649b3d180e4.zip
Adopt and a terminal reader's failure are inputs (Pardes.adoptShell, readerFailed; tape.Input adopt_shell, reader_failed): tty.zig's and gui.zig's adoptShell ran the Tty word and cleared the pane's greeting straight on the core, and the window's reader failure set its pane's mode, between steps and untaped, so every client of a session that took in a dead session's shells joined again (the hunt's H15: `the unit of 0/48 diverged: the core called poll_frame where the tape has a host (10)`, gone after); replica.zig's test, which the old writes fail
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index a4fcb2d3..81ea0cdd 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -5557,6 +5557,36 @@ pub const Pardes = struct {
return if (selected.len == 0) config.defaultShell() else selected;
}
+ /// A shell a dead session left, taken in (Adopt): a terminal pane made
+ /// for it as the Tty word makes one, its greeting off (the shell is up
+ /// already), whose spawn the host answers with that shell's pty. Its id,
+ /// or null with no room. An input, as every host write into the core
+ /// is: a replica of the session makes the same pane.
+ pub fn adoptShell(p: *Pardes) ?u8 {
+ const taped = tape.enter(p, .adopt_shell);
+ defer tape.leave(p, taped);
+ var newest: u32 = 0;
+ for (p.panes) |slot| if (slot) |pn| {
+ newest = @max(newest, pn.serial);
+ };
+ _ = p.executeBuiltinLine(p.active, "Tty");
+ for (p.panes, 0..) |slot, id| if (slot) |pn| if (pn.serial > newest and pn.isTerminal()) {
+ pn.greet = false;
+ return @intCast(id);
+ };
+ return null;
+ }
+
+ /// A terminal's reader failed (no end of file: the host closed its pty):
+ /// its pane takes keys again, and why is said.
+ pub fn readerFailed(p: *Pardes, id: u8, err: anyerror) void {
+ const taped = tape.enter(p, .{ .reader_failed = .{ .id = id, .err = err } });
+ defer tape.leave(p, taped);
+ const pane = p.panes[id] orelse return;
+ pane.body.mode = .normal;
+ p.reportError(id, "terminal reader", err);
+ }
+
pub fn acknowledgeShell(p: *Pardes, id: usize, executable: []const u8, prompt_marks: bool) void {
const taped = tape.enter(p, .{ .acknowledge_shell = .{ .id = id, .executable = executable, .prompt_marks = prompt_marks } });
defer tape.leave(p, taped);