diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 02:49:22 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 02:49:22 -0300 |
| commit | 083167d5b6bc403395f18ddb5e07a2743bb2632f (patch) | |
| tree | af6cbf60ba9d5b94fa74c613d743f00f8737ec04 /src/ninep | |
| parent | bc4987d2294c9b9cf641b0f9686392611682cc0e (diff) | |
| download | pardes-083167d5b6bc403395f18ddb5e07a2743bb2632f.tar.gz pardes-083167d5b6bc403395f18ddb5e07a2743bb2632f.zip | |
A size refusal quotes the bad value, "5 2", not the word size
size quoted its own word in every refusal, as bad values were quoted
before round 31's change for the settings. The value is the offending
word here too, and is now what each size refusal quotes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/ctl.zig | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 9092a307..5d08a77f 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -661,10 +661,12 @@ pub fn writeRoot(p: *Pardes, req: Req) Reply { continue; } if (std.mem.startsWith(u8, line, "size ") or std.mem.eql(u8, line, "size")) { - const size = sizeOf(line) orelse return refuse(p, req, e_size, line); + // The offending word is the value: `size 5 5` quotes "5 5". + const value = std.mem.trim(u8, line["size".len..], " \t"); + const size = sizeOf(line) orelse return refuseQuoting(p, req, e_size, value); // A frontend's window is the size; only a session none is // attached to (--detach, unattended) takes one written. - if (!p.unattended) return refuse(p, req, "size: a frontend is attached and owns the size", line); + if (!p.unattended) return refuseQuoting(p, req, "size: a frontend is attached and owns the size", value); if (apply) { const was: [2]u16 = .{ p.screen_w, p.screen_h }; const before = p.rects; @@ -677,7 +679,7 @@ pub fn writeRoot(p: *Pardes, req: Req) Reply { if (!pardes.layout.minimaFit(p)) { p.update(.{ .resize = .{ .cols = was[0], .rows = was[1] } }); p.sync(); - return refuse(p, req, "size: too small for the panes, each its tag and 2 rows", line); + return refuseQuoting(p, req, "size: too small for the panes, each its tag and 2 rows", value); } pardes.layout.restoreMinima(p, &before); p.sync(); @@ -2392,6 +2394,8 @@ test "size sets the screen of a session no frontend is attached to, and only of try testing.expectEqual(E.INVAL, wr(p, root_ctl, "size 120\n").errno()); try testing.expectEqual(E.INVAL, wr(p, root_ctl, "size\n").errno()); try testing.expect(std.mem.indexOf(u8, wr(p, root_ctl, "size 5 2\n").reply.ename, "at least 20x6, at most 4096x4096") != null); + // The bad value quoted, never the word size. + try testing.expect(std.mem.endsWith(u8, wr(p, root_ctl, "size 5 2\n").reply.ename, "\"5 2\"")); // Too small for the panes it has, each its tag and two rows: refused, // the size as it was. for (0..4) |_| p.newScratchBelow(p.active); |
