summaryrefslogtreecommitdiff
path: root/core/ninep/pty.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 06:56:46 -0300
committerGabriel Schneider <[email protected]>2026-11-20 06:56:46 -0300
commit2c2800c93e5417297dd06d3e52d5d336d975560c (patch)
treea028181f6c0fa1115df2f4862622fefb954a62d5 /core/ninep/pty.zig
parentffe05cceb897b3ae6a6d36491f9318a8aa3426e7 (diff)
parent0165bc532446e61a74af604c493d6b354abf798a (diff)
downloadpardes-2c2800c93e5417297dd06d3e52d5d336d975560c.tar.gz
pardes-2c2800c93e5417297dd06d3e52d5d336d975560c.zip
integration: a client that joins during a 9P pty/run replays it as its session does, and a far client's Del question is instant, on the build's second pass: pardes-faults-3 (a 9P open's handle is the session's recorded answer; a run reads its terminal's prompt marks through the tape's prompt site; a rejoin that lands as the session ends says so; Del sets question_asked and the host's pump gives it its time: the step reads no clock, so the bytes soak's one stop off may_wait, now, is gone) and pardes-merge32, merged without a textual conflict; the coordinator's gate in the ledger (reorg/merge33)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/ninep/pty.zig')
-rw-r--r--core/ninep/pty.zig14
1 files changed, 11 insertions, 3 deletions
diff --git a/core/ninep/pty.zig b/core/ninep/pty.zig
index 938f3366..4b0cee66 100644
--- a/core/ninep/pty.zig
+++ b/core/ninep/pty.zig
@@ -220,7 +220,7 @@ pub fn writeRun(p: *Pardes, req: Req, id: usize, pane: *Pane) Reply {
for (line) |c| if (c < ' ' and c != '\t') return tree.failText(req.tag, E.INVAL, e_bad_line);
const pf = &pane.fs;
if (pane.terminal == null) return tree.failText(req.tag, E.INVAL, e_bad_line);
- const marks = pardes.Term.prompt(pane.terminal);
+ const marks = marksOf(pane);
if (pane.shell_failed) {
// Its shell never started: no prompt is coming to wait for.
answer(p, slot, "error shell gone", .{});
@@ -288,7 +288,7 @@ pub fn noteMarks(p: *Pardes, id: usize, pane: *Pane) void {
if (pane.terminal == null) return;
const pf = &pane.fs;
const slot = waitingRun(p, pane) orelse return;
- const marks = pardes.Term.prompt(pane.terminal);
+ const marks = marksOf(pane);
if (slot.phase == .waiting) {
if (pf.unmarked) {
answer(p, slot, "error no prompt marks", .{});
@@ -305,7 +305,7 @@ pub fn noteMarks(p: *Pardes, id: usize, pane: *Pane) void {
if (pardes.Term.modes(pane.terminal).alternate) pane.feedOutput(p, "\x1b[?1049l");
p.emitWrite(id, slot.line);
p.emitWrite(id, "\r");
- pane.noteCommand(slot.line);
+ pane.noteCommand(slot.line, marks.started);
// The run is the shell's first command: a greeting `ls` typed at the
// same prompt would run after it, and its C would be taken for ours.
pane.greet = false;
@@ -360,6 +360,14 @@ pub fn noteMarks(p: *Pardes, id: usize, pane: *Pane) void {
finish(p, slot, pane, done.status);
}
+/// The shell's marks as the session's emulator has them (taped), as a
+/// run's step reads them: a screen-state replica's emulator is the last
+/// delta's, which comes at a frame and can be a unit behind the one it
+/// replays.
+fn marksOf(pane: *const Pane) pardes.Term.Prompt {
+ return pardes.tape.value(.prompt, pardes.Term.prompt, .{pane.terminal});
+}
+
/// Answers a run whose command ended with `status`: the header and the
/// output it printed.
fn finish(p: *Pardes, slot: *Run, pane: *Pane, status_code: ?i32) void {