diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-06 12:56:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-06 14:56:36 -0300 |
| commit | d78fa4f9d90437dac60d9150e3a6eca868895856 (patch) | |
| tree | 69e8cb2f47960307bc39296b76fc3b6fdd64a647 /src/Core.zig | |
| parent | 34a80c9f9b81b64d095a1d5123ae74a52bef4749 (diff) | |
| download | pardes-d78fa4f9d90437dac60d9150e3a6eca868895856.tar.gz pardes-d78fa4f9d90437dac60d9150e3a6eca868895856.zip | |
idioms #18, std.Io's names and fewer forms: the core's path functions are std.Io.Dir.path's and max_path_bytes std.Io.Dir's (std.fs's are deprecated aliases), pinOf takes the *const PageList it is always given, normal's @hasDecl guard goes (@field says the same), deleteSelection returns edit.Error, and a Look miss too long for its buffer is said cut where it said `no match`
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/Core.zig')
| -rw-r--r-- | src/Core.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Core.zig b/src/Core.zig index c7d2fd48..413de233 100644 --- a/src/Core.zig +++ b/src/Core.zig @@ -551,7 +551,7 @@ fn initSession(gpa: std.mem.Allocator, opts: Options) !*Pardes { }; const content = try std.fmt.allocPrint(gpa, "cannot open\n\n\t{s}\n\n{s}\n", .{ path, why }); errdefer gpa.free(content); - _ = try pardes.panes.Output.open(p, 0, std.fs.path.dirname(path) orelse "/", .errors, "", content); + _ = try pardes.panes.Output.open(p, 0, std.Io.Dir.path.dirname(path) orelse "/", .errors, "", content); } p.oneColumn(); }, @@ -574,7 +574,7 @@ fn initSession(gpa: std.mem.Allocator, opts: Options) !*Pardes { const dir = p.sessionDir(); const shown = try pardes.panes.Output.open(p, 0, dir, .{ .cmd = .New }, "", content); // Named +Pager, as `pardes -` inside a session names its pane. - const named = try std.fs.path.join(gpa, &.{ dir, "+Pager" }); + const named = try std.Io.Dir.path.join(gpa, &.{ dir, "+Pager" }); gpa.free(shown.file.?.path); shown.file.?.path = named; shown.file.?.pager = true; @@ -981,7 +981,7 @@ pub fn acknowledgeShell(p: *Pardes, id: usize, executable: []const u8, prompt_ma if (pane.command == null) { // A shell given as a path keeps it: its bare name would find // nothing, or another program, on the usual paths. - const base = if (pane.shell) |given| (if (std.mem.indexOfScalar(u8, given, '/') != null) given else std.fs.path.basename(executable)) else std.fs.path.basename(executable); + const base = if (pane.shell) |given| (if (std.mem.indexOfScalar(u8, given, '/') != null) given else std.Io.Dir.path.basename(executable)) else std.Io.Dir.path.basename(executable); const rest = tagline.terminal_pane_tail[" Term".len..]; if (std.fmt.bufPrint(&pane.shell_tail, " Term+{s}{s}", .{ base, rest })) |tail| { pane.shell_tail_len = @intCast(tail.len); @@ -1311,7 +1311,7 @@ fn sayShellFailure(p: *Pardes, id: u8, err: anyerror) void { /// The program the shell's `#!` names that is not there, in `out`. fn missingInterpreter(bin: []const u8, out: []u8) ?[]const u8 { const Shell = @import("host_io.zig").Shell; - var buf: [std.fs.max_path_bytes]u8 = undefined; + var buf: [std.Io.Dir.max_path_bytes]u8 = undefined; return Shell.missingInterpreter(Shell.find(bin, &buf) orelse return null, out); } @@ -1319,7 +1319,7 @@ fn missingInterpreter(bin: []const u8, out: []u8) ?[]const u8 { /// what is there (a directory when it is no local path), whether it is /// missing, and whether that is because one above refuses (EACCES). fn parentTrouble(path: []const u8, err: anyerror) struct { dir: []const u8, kind: ?std.Io.File.Kind, missing: bool, denied: bool } { - const dir = std.fs.path.dirname(path) orelse "/"; + const dir = std.Io.Dir.path.dirname(path) orelse "/"; const local = filesystem.localPath(dir); const kind: ?std.Io.File.Kind = if (local) |l| exec.kindOf(l) else .directory; const missing = err == error.FileNotFound or err == error.NotDir or kind != .directory; |
