From 36241daca2aaf90cc8933dffd95fc3cd6216e2b7 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 09:13:55 -0300 Subject: /index shows names as the log does, one line of UTF-8, and a newline in a name as \n /index printed a name as it was, so a directory with a newline in it split its row in two, and bytes not UTF-8 went through; the log turned the newline into a space, silently another name. Both now show a name one way: a newline `\n`, other controls, DEL and C1 a space, bytes not UTF-8 `\xNN`. Co-Authored-By: Claude Opus 5.5 --- src/ninep/tree.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/ninep/tree.zig') diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index 391847f5..c089c31d 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -917,7 +917,11 @@ fn readFile(p: *Pardes, req: Req, target: Target) Reply { last = serial; const id = p.paneBySerial(serial).?; const pn = p.panes[id].?; - out.print(p.gpa, "{d} {s} {d} {s} {d}\n", .{ serial, pane.kindOf(pn), @intFromBool(pane.dirtyOf(pn)), pane.nameOf(pn), pane.columnOf(p, id) }) catch {}; + // A name as /log shows it: one line of UTF-8, a + // newline in it `\n` (events.shown). + var name_buf: [4 * 4096]u8 = undefined; + const name = events.shown(pane.nameOf(pn), &name_buf); + out.print(p.gpa, "{d} {s} {d} {s} {d}\n", .{ serial, pane.kindOf(pn), @intFromBool(pane.dirtyOf(pn)), name, pane.columnOf(p, id) }) catch {}; } break :index stagedReply(p, req); }, -- cgit v1.3