From dd6a3c2c367cee12a8e2da81e7da6a2c8f3103d5 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 23:20:19 -0300 Subject: Round 39's small ones: a name write past its one line is refused by that write; Get and Edit's e load over a scratch under 100 bytes unasked, as Del closes it; Putall saves a Zerox pair once; bare Tab on the root ctl says the width as from a pane, and a ctl check of Tab no longer sets it; a directory read is "is a directory" (EISDIR), an unreadable file "permission denied" (EACCES), Incl of a file "not a directory" (ENOTDIR), and a device "not a regular file", never read to the stream limit Co-Authored-By: Claude Opus 5.5 --- src/builtins.zig | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/builtins.zig') diff --git a/src/builtins.zig b/src/builtins.zig index 70ca93a1..c42d4978 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1157,7 +1157,9 @@ pub const Get = struct { const errno = if (typed.len == 0) ctl.get(c.p, c.pane, &failed) else ctl.getFile(c.p, c.pane, path, &failed); if (errno != 0) { var said: [320]u8 = undefined; - c.p.reportFailure(c.id, std.fmt.bufPrint(&said, "Get: {s}: {s}", .{ path[0..@min(path.len, 256)], if (failed == error.FileNotFound) "no such file" else "cannot be read" }) catch "Get: cannot be read"); + var words: [128]u8 = undefined; + const why = if (failed == error.FileNotFound) "no such file" else pardes.Messages.errorWords(failed, &words); + c.p.reportFailure(c.id, std.fmt.bufPrint(&said, "Get: {s}: {s}", .{ path[0..@min(path.len, 256)], why }) catch "Get: cannot be read"); } } }; @@ -1172,6 +1174,10 @@ pub const Putall = struct { const pane = slot orelse continue; const f = pane.file orelse continue; if (f.output != null or f.listing != null or f.revision == f.saved_revision) continue; + // A Zerox pair is one buffer: saved once, by its first pane. + if (f.twin != 0) if (for (c.p.panes[0..id]) |earlier| { + if ((earlier orelse continue).file) |ef| if (ef.twin == f.twin) break true; + } else false) continue; exec.saveFile(c.p, id); } } @@ -1203,7 +1209,10 @@ pub const Incl = struct { var home_buf: [4096]u8 = undefined; const expanded = @import("fs.zig").expandHome(dir_word, &home_buf); if (comptime pardes.hosted) if (@import("fs.zig").localPath(expanded)) |local| if (!exec.isDirectory(local)) - return p.reportFailure(c.id, std.fmt.bufPrint(&said, "Incl: no such directory: {s}", .{shown}) catch "Incl: no such directory"); + return p.reportFailure(c.id, if (exec.kindOf(local) != null) + std.fmt.bufPrint(&said, "Incl: not a directory: {s}", .{shown}) catch "Incl: not a directory" + else + std.fmt.bufPrint(&said, "Incl: no such directory: {s}", .{shown}) catch "Incl: no such directory"); } var words = std.mem.tokenizeAny(u8, typed, " \t"); while (words.next()) |dir_word| { -- cgit v1.3