From 4178fdf514b637cafde6325086e0ce66e2cafaa2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 06:52:47 -0300 Subject: A file name with a newline is refused naming it once: `pardes: two\nlines.txt: a file name is one line...`, not `a file name: a file name ...` The refusal's subject was the words "a file name", and its reason began with them again. It now names the name given, its newline shown `\n`, as /log and /index show one. Co-Authored-By: Claude Opus 5.5 --- src/main.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index 99e94889..08ead756 100644 --- a/src/main.zig +++ b/src/main.zig @@ -621,7 +621,12 @@ fn nativeMain(init: std.process.Init) !void { try std.Io.File.stderr().writeStreamingAll(init.io, nested_text); std.process.exit(1); }; - if (std.mem.indexOfAny(u8, typed_word, "\r\n") != null) Refuse.with(init.io, "a file name", error.NotOneLine); + // Named as it was given, its newline shown `\n`, so the refusal says + // which name and why once. + if (std.mem.indexOfAny(u8, typed_word, "\r\n") != null) { + var shown_buf: [4 * 4096]u8 = undefined; + Refuse.with(init.io, pardes.ctlfs.events.shown(typed_word[0..@min(typed_word.len, 4096)], &shown_buf), error.NotOneLine); + } // `pardes '~/x'`, quoted so the shell left it: home, as a look's. var home_buf: [4096]u8 = undefined; const word = pardes.filesystem.expandHome(typed_word, &home_buf); -- cgit v1.3