From 7c4cb0a7badecdd91e910c64b824eff68eae1b84 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 00:56:51 -0300 Subject: Edit's refusals name the pattern, not the line, and say when dot is empty A ctl Edit that missed answered `Edit: no match for regexp "Edit /nomatch/d"`, quoting the whole program; it now names the address that missed (`no match for regexp /nomatch/`) and quotes no line after. An s on an empty dot says `no substitution: dot is empty`. A \\1 is blamed only once its pattern has matched, as before. tags.md says & is special in s and not in c, a or i, as in sam. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ninep') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index e1dd3fc5..2fdc47cc 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -332,7 +332,10 @@ pub fn runBuiltin(p: *Pardes, req: Req, id: usize, line: []const u8) ?Reply { if (!created) noteResult(p, context); if (p.fs.refused) return refuse(p, req, e_prompt, line); if (p.fs.failure_len == 0) return null; - const refusal = refuse(p, req, p.fs.failure[0..p.fs.failure_len], line); + // An Edit's failure names what failed (the pattern that missed): its + // line, a program, is not quoted after it. + const edit = std.mem.startsWith(u8, line, "Edit ") or std.mem.eql(u8, line, "Edit"); + const refusal = if (edit) tree.failText(req.tag, E.IO, p.fs.failure[0..p.fs.failure_len]) else refuse(p, req, p.fs.failure[0..p.fs.failure_len], line); return .{ .tag = req.tag, .status = .err, .errno = E.IO, .ename = refusal.ename }; } -- cgit v1.3