summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.zig7
-rw-r--r--test/fs.py2
2 files changed, 7 insertions, 2 deletions
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);
diff --git a/test/fs.py b/test/fs.py
index 2ccd0690..270ac367 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -1561,7 +1561,7 @@ def test(binary, quic=False):
finally:
shut.chmod(0o755)
for word, said in (('@p999:1', b'pardes: @p999:1: this session has no such pane'),
- ('two\nlines.txt', b'a file name is one line')):
+ ('two\nlines.txt', b'pardes: two\\nlines.txt: a file name is one line')):
refused = subprocess.run([binary, word], cwd=root, env=env,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=10)
assert refused.returncode == 1, refused