summaryrefslogtreecommitdiff
path: root/src/gui/gui.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/gui/gui.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/gui/gui.zig')
-rw-r--r--src/gui/gui.zig18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index ead89a8a..be287647 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -4563,21 +4563,14 @@ const Shell = struct {
var buf: [96]u8 = undefined;
return core.setMessage(core.active, if (s.adopted == 0) "Adopt: no shell of a session that died is waiting" else std.fmt.bufPrint(&buf, "Adopt: {d} shell{s} taken in; what they showed is gone", .{ s.adopted, if (s.adopted == 1) "" else "s" }) catch "Adopt: shells taken in");
}
- var newest: u32 = 0;
- for (core.panes) |slot| if (slot) |pn| {
- newest = @max(newest, pn.serial);
- };
if (s.adoptions_len < s.adoptions.len) {
s.adoptions[s.adoptions_len] = .{ .pid = pid, .fd = fd, .pane = null };
s.adoptions_len += 1;
- _ = core.executeBuiltinLine(core.active, "Tty");
- for (core.panes, 0..) |slot, id| if (slot) |pn| if (pn.serial > newest and pn.isTerminal()) {
- // Its shell is up already: nothing to greet with `ls`.
- pn.greet = false;
- s.adoptions[s.adoptions_len - 1].pane = @intCast(id);
+ if (core.adoptShell()) |id| {
+ s.adoptions[s.adoptions_len - 1].pane = id;
s.adopted += 1;
return;
- };
+ }
s.adoptions_len -= 1;
}
_ = libc.close(fd);
@@ -4662,10 +4655,7 @@ const Shell = struct {
if (s.gens[e.pane] == e.gen) eof: {
if (e.failure) |err| {
s.closePty(e.pane);
- if (s.core.panes[e.pane]) |pane| {
- pane.body.mode = .normal;
- s.core.reportError(e.pane, "terminal reader", err);
- }
+ s.core.readerFailed(e.pane, err);
break :eof;
}
const pt = if (s.ptys[e.pane]) |*pt| pt else {