summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 21:45:41 -0300
committerGabriel Schneider <[email protected]>2026-11-04 21:58:21 -0300
commit351b27091c894766cba4b61e49c37f2771605779 (patch)
tree0c4da0edc0c390cfaeaceaab89199af3abb503cf /src
parent528a66cc720b25252a497adeb358e729dc8f3a62 (diff)
parentfac51df2abec19e57932e0fbe4492d372d7daac2 (diff)
downloadpardes-351b27091c894766cba4b61e49c37f2771605779.tar.gz
pardes-351b27091c894766cba4b61e49c37f2771605779.zip
merge the window's new-shell fix (a new terminal's first pty/run waited for ever, its greeting typed at the same first prompt after the window's resize; the canary's Newcol refused, the runner's 80x24 terminal shrinking the window), onto the window tier: every process the runner starts is kept off the user's display (WAYLAND_DISPLAY and DISPLAY unset, SDL_VIDEO_DRIVER=offscreen, in Child.spawn), as a second pardes-gui a case started could open a window there; a window's grid is its case's (Detached.Options.grid: its terminal's size and PARDES_TEST_COLS and _ROWS), the goldens regenerated at the 120x40 they were made for (they had been captured at the 80x24 the runner bug gave) and twice reproduced, the monkey at 80x28; gui.zig's comments point at test/process/window.zig; tui 38 (2 skipped), gui 33 and 5 skipped
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui.zig4
-rw-r--r--src/ninep/pty.zig24
2 files changed, 26 insertions, 2 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index 15347eb6..ac32ced4 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -9487,7 +9487,7 @@ fn latencyNote(comptime fmt: []const u8, args: anytype) void {
/// Writes the frame to latest.ppm in the capture directory, and a panel
/// transition's frame `transition` to transition-<frame>.ppm too, so a test
-/// can hold one partway (test/gui_golden.py).
+/// can hold one partway (test/process/window.zig).
fn captureFrame(g: *Gui, gpa: std.mem.Allocator, cmd: *c.SDL_GPUCommandBuffer, target: *c.SDL_GPUTexture, sw: u32, sh: u32, transition: ?u16) !void {
const size = c.SDL_CalculateGPUTextureFormatSize(g.swapchain_format, sw, sh, 1);
if (size == 0) {
@@ -9529,7 +9529,7 @@ fn captureFrame(g: *Gui, gpa: std.mem.Allocator, cmd: *c.SDL_GPUCommandBuffer, t
g.captured +%= 1;
}
-/// A test window's state for a harness (test/gui_golden.py), in the
+/// A test window's state for a harness (test/process/window.zig), in the
/// capture directory's `status`: "<loop step> <frames captured> <idle>".
/// Idle is 1 once the frame last captured is the one that stays: nothing
/// owes a frame, nothing moves, nothing waits on a clock. A harness that
diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig
index 5c9a6289..5a974adf 100644
--- a/src/ninep/pty.zig
+++ b/src/ninep/pty.zig
@@ -324,6 +324,9 @@ pub fn noteMarks(p: *Pardes, id: usize, pane: *Pane) void {
p.emitWrite(id, slot.line);
p.emitWrite(id, "\r");
pardes.panes.terminal.noteCommand(pane, slot.line);
+ // 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;
slot.phase = .sent;
return;
}
@@ -768,6 +771,27 @@ test "pty/data writes at the shell and reads the raw stream" {
try testing.expectEqualStrings("still", rd(p, data, 0, 64).bytes);
}
+test "a run waiting for a new terminal's first prompt is the only line typed there, no greeting after it" {
+ const gpa = testing.allocator;
+ const p = try withTerm(gpa);
+ defer p.deinit();
+ p.panes[0].?.greet = true; // a Term's, in a window (resized)
+ p.update(.{ .resize = .{ .cols = 80, .rows = 24 } });
+ while (p.nextEffect()) |_| {}
+ const node = Node.of(serialOf(p), .pty_run);
+ const h = call(p, .{ .tag = 1, .op = .open, .node = node }).reply.handle;
+ _ = call(p, .{ .tag = 2, .op = .write, .node = node, .handle = h, .data = "true\n" });
+ p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b]133;A;cl=line;aid=pardes\x07$ \x1b]133;B;aid=pardes\x07" } });
+ var sent: [32]u8 = undefined;
+ var len: usize = 0;
+ while (p.nextEffect()) |e| if (e == .write) {
+ const b = e.write.bytes.slice();
+ @memcpy(sent[len..][0..b.len], b);
+ len += b.len;
+ };
+ try testing.expectEqualStrings("true\r", sent[0..len]);
+}
+
test "run answers how its command ended once the shell is back at a prompt" {
const gpa = testing.allocator;
const p = try withTerm(gpa);