diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 17:14:40 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | 3d0d5e5de54611a88826600365bf0849d9ac4871 (patch) | |
| tree | 5b26dbe757826e63fc2329bb66833951317ceb53 /src/ninep/pane.zig | |
| parent | 3723046ff06dc3d954a611a2bb195790547669c0 (diff) | |
| download | pardes-3d0d5e5de54611a88826600365bf0849d9ac4871.tar.gz pardes-3d0d5e5de54611a88826600365bf0849d9ac4871.zip | |
A tag rewrite counts its text without the newline it drops: echo of exactly 4096 bytes fits
`echo <4096 bytes> > tag` wrote 4097 bytes and was refused "over 4096
bytes", although a rewrite drops that one trailing newline and would have
held exactly 4096. The limit now counts a truncating write's text without
the newline it drops, for a pane's, a column's and the workspace's tag. An
append still counts its newline, which it keeps.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/pane.zig')
| -rw-r--r-- | src/ninep/pane.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index fef0f85f..d5f2f20a 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -662,7 +662,11 @@ fn writeTag(p: *Pardes, req: Req, pane: *Pane) Reply { // is a text like any other (acme's tag file appends the same way). const had = if (pf.tag_trunc_pending) 0 else tagline.curTail(pane).len; const room = limits.max_tag_tail -| had -| @intFromBool(pf.tag_held_newline and !pf.tag_trunc_pending); - if (req.data.len > room) { + // A rewrite drops its one trailing newline: `echo <4096 bytes> > tag` + // is 4096 bytes of tag, and fits. + const rewrite = pf.tag_rewrite or pf.tag_trunc_pending; + const counted = req.data.len - @intFromBool(rewrite and req.data[req.data.len - 1] == '\n'); + if (counted > room) { pf.tag_trunc_pending = false; return tree.failText(req.tag, E.NOSPC, e_tag_over); } |
