diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 11:20:48 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | 2c98513a23d060093d690dbd7743dda5ad86c117 (patch) | |
| tree | 659caed05062b262cf81fbbe701f6ef690a03f55 /src/look.zig | |
| parent | 53fcf030b175fc035e62d1d471c01c2e0caefc9e (diff) | |
| download | pardes-2c98513a23d060093d690dbd7743dda5ad86c117.tar.gz pardes-2c98513a23d060093d690dbd7743dda5ad86c117.zip | |
A look at a ./ or ../ name that is not there names the file, not the pane's directory
Any relative name that opened nothing was blamed on the pane's directory (look: .../work/many: no such directory) though it exists; the directory is named only when it is gone. A plain name is still looked for as text, its miss logged as any look's.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/look.zig')
| -rw-r--r-- | src/look.zig | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/look.zig b/src/look.zig index f45fe583..236f0687 100644 --- a/src/look.zig +++ b/src/look.zig @@ -1470,12 +1470,16 @@ pub fn lookAt(p: *Pardes, id: usize, operand: []const u8) void { } switch (found) { .none => { - // `.` or `..` from a pane whose directory is gone: said, ENOENT, - // not searched for as a word. + // A `./` or `../` name opened nothing: said, ENOENT, not searched + // for as a word. What is missing is the pane's directory when + // that is gone, else the file named. if (filesystem.dotRelative(trimmed)) { const dir = Pardes.paneDir(pane); var said: [4200]u8 = undefined; - return p.reportFailure(id, std.fmt.bufPrint(&said, "look: {s}: no such directory", .{dir[0..@min(dir.len, 4096)]}) catch "look: no such directory"); + const gone = if (comptime pardes.hosted) if (filesystem.localPath(dir)) |local| !exec.isDirectory(local) else false else true; + if (gone) return p.reportFailure(id, std.fmt.bufPrint(&said, "look: {s}: no such directory", .{dir[0..@min(dir.len, 4096)]}) catch "look: no such directory"); + var cut: [miss_path_cap + "…".len]u8 = undefined; + return p.reportFailure(id, std.fmt.bufPrint(&said, "look: {s}: no such file", .{missText(trimmed, &cut)}) catch "look: no such file"); } // A raw terminal's clicks are its program's; a look written over // 9P is no keyboard input, and searches whatever the key mode. |
