diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-06 14:39:47 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-06 14:56:36 -0300 |
| commit | e8e7ed956f3914a3790e980df0862b26c30bd611 (patch) | |
| tree | 53d3247c594717f79745ad20c5dd23bf16ed59ea /src/look.zig | |
| parent | a821fe82d8de3d407ebe104358b97719bd983727 (diff) | |
| download | pardes-e8e7ed956f3914a3790e980df0862b26c30bd611.tar.gz pardes-e8e7ed956f3914a3790e980df0862b26c30bd611.zip | |
idioms #20, the bound in the type or the cut handled: of the 166 `catch unreachable` the pass kept, 64 stay where a reader checks the bound without arithmetic (an integer's digits, a declared field's size, and now the daemon's pid lists and the clock's two-digit fields written in their types), 69 texts print through Kind.Buf at their old size, 31 handle the failure once (a print into ename cut at its 320, paneText's line cut where its buffer fills, a log record or mouse report dropped rather than cut short, the question's letters that fit), Newcol's and pane/new's refusals are comptime strings, and dropUnsaved's too-long scratch name is null, not an empty sentinel
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/look.zig')
| -rw-r--r-- | src/look.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/look.zig b/src/look.zig index aee96513..0414f6d1 100644 --- a/src/look.zig +++ b/src/look.zig @@ -1295,9 +1295,9 @@ fn lookUnresolved(p: *Pardes, id: usize, pane: *Pane, trimmed: []const u8, text: // that is gone, else the file named. if (filesystem.dotRelative(trimmed)) { const dir = Pardes.paneDir(pane); - var said: [4096 + 104]u8 = undefined; + var said: Kind.Buf(4096 + 104) = .{}; const gone = if (filesystem.localPath(dir)) |local| exec.kindOf(local) != .directory else false; - if (gone) return p.reportFailure(id, std.fmt.bufPrint(&said, "look: {s}: no such directory", .{dir[0..@min(dir.len, 4096)]}) catch unreachable); // 4096 + 27 fits 4096 + 104 + if (gone) return p.reportFailure(id, said.print("look: {s}: no such directory", .{dir[0..@min(dir.len, 4096)]})); // A file not there is a miss, as `x` and `/abs/x` are: said and // logged, the write answered with nothing. var cut: [miss_path_cap + "…".len]u8 = undefined; @@ -1755,8 +1755,8 @@ pub fn lookAt(p: *Pardes, id: usize, operand_raw: []const u8) void { // A directory that is not there (the pane's own, gone): said, // ENOENT, no terminal made in it. if (filesystem.localPath(dir)) |local| if (exec.kindOf(local) != .directory) { - var said: [4096 + 104]u8 = undefined; - return p.reportFailure(id, std.fmt.bufPrint(&said, "look: {s}: no such directory", .{dir[0..@min(dir.len, 4096)]}) catch unreachable); // 4096 + 27 fits 4096 + 104 + var said: Kind.Buf(4096 + 104) = .{}; + return p.reportFailure(id, said.print("look: {s}: no such directory", .{dir[0..@min(dir.len, 4096)]})); }; // acme's: a pane listing it (Dir.zig). panes.Dir.look(p, id, dir); |
