summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
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);