diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-06 12:40:11 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-06 14:56:36 -0300 |
| commit | a66a9eb6e0c69cfcb63717bc27704cdc96f382b4 (patch) | |
| tree | 400e3034a6c71c1d15d0ad302e1293a4290071b9 /src/Output.zig | |
| parent | 36a51ddc67d0beb7d9851fb2425cf780a47fed36 (diff) | |
| download | pardes-a66a9eb6e0c69cfcb63717bc27704cdc96f382b4.tar.gz pardes-a66a9eb6e0c69cfcb63717bc27704cdc96f382b4.zip | |
idioms #11, the command layer: exec, builtins, edit_cmd, Messages, Dir, Output, Jump and Pipe say their messages through buffers proven big enough (or the long argument cut) instead of placeholder text, replId takes its 48-byte buffer, a failed Save path, Get or Incl path, Repl send, Tutor, +Unsaved, pipe or Edit output on OOM is reported (reportError) rather than silently dropped, Edit's why and zonWhy cut a long text instead of losing it, and writeFailure names its set
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/Output.zig')
| -rw-r--r-- | src/Output.zig | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Output.zig b/src/Output.zig index 20d672d2..ceffa7d9 100644 --- a/src/Output.zig +++ b/src/Output.zig @@ -485,7 +485,7 @@ pub fn fillResults(p: *Pardes, id: usize, dir: []const u8, from: Origin, arg: [] const output = if (rf.output) |*o| o else continue; if (!std.meta.eql(output.from, from)) continue; if (by_arg and !std.mem.eql(u8, output.arg(), arg)) continue; - if (!std.mem.eql(u8, std.fs.path.dirname(rf.path) orelse "", dir)) continue; + if (!std.mem.eql(u8, std.Io.Dir.path.dirname(rf.path) orelse "", dir)) continue; if (!locations.sameInput(content, rf.content, rf.location_rows, p.locations_config.layout)) continue; try setArg(output, arg); p.gpa.free(content); @@ -534,7 +534,7 @@ pub fn fillRows(p: *Pardes, id: usize, dir: []const u8, from: Origin, arg: []con if (i == id and !shared) continue; if (!shared and !std.meta.eql(o.from, from)) continue; if (!shared and by_arg and !std.mem.eql(u8, o.arg(), arg)) continue; - if (!std.mem.eql(u8, std.fs.path.dirname(rf.path) orelse "", dir)) continue; + if (!std.mem.eql(u8, std.Io.Dir.path.dirname(rf.path) orelse "", dir)) continue; o.from = from; p.fs.refilled = rp.serial; try setArg(o, arg); @@ -582,7 +582,7 @@ pub fn fillRows(p: *Pardes, id: usize, dir: []const u8, from: Origin, arg: []con /// stands elsewhere), for Diff to go back to it. The +Diff's id; /// NoHunks when there is none in it. pub fn openDiff(p: *Pardes, id: usize, path: []const u8, content: []const u8) !usize { - const dir = std.fs.path.dirname(path) orelse p.sessionDir(); + const dir = std.Io.Dir.path.dirname(path) orelse p.sessionDir(); const root = hunks.sourceRoot(p, dir, content); const result = try hunks.format(p, root, content); errdefer { @@ -592,7 +592,7 @@ pub fn openDiff(p: *Pardes, id: usize, path: []const u8, content: []const u8) !u var has_hunk = false; for (result.rows) |row| has_hunk = has_hunk or row.kind == .match; if (!has_hunk) return error.NoHunks; - const arg = if (std.mem.eql(u8, root, dir) or path.len > max_arg) std.fs.path.basename(path) else path; + const arg = if (std.mem.eql(u8, root, dir) or path.len > max_arg) std.Io.Dir.path.basename(path) else path; return fillRows(p, id, root, .{ .cmd = .Diff }, arg, result.content, result.rows, null); } @@ -622,7 +622,7 @@ pub fn diffSource(p: *Pardes, f: *const File.State) ?[]const u8 { if (!std.meta.eql(o.from, Origin{ .cmd = .Diff })) return null; const arg = o.arg(); if (arg.len > 0 and arg[0] == '/') return arg; - return std.fs.path.join(p.scratch.allocator(), &.{ std.fs.path.dirname(f.path) orelse "", arg }) catch null; + return std.Io.Dir.path.join(p.scratch.allocator(), &.{ std.Io.Dir.path.dirname(f.path) orelse "", arg }) catch null; } pub fn openJumps(p: *Pardes, id: usize) !void { @@ -718,7 +718,7 @@ pub fn openUnsaved(p: *Pardes, id: usize, content: []u8) void { // goes in the session's, where a look from it can still resolve. const dir = if (pardes.filesystem.localPath(own)) |local| (if (exec.kindOf(local) == .directory) own else p.sessionDir()) else own; const free = p.freeSlot() orelse return p.gpa.free(content); - _ = open(p, free, dir, .unsaved, "", content) catch return; + _ = open(p, free, dir, .unsaved, "", content) catch |err| return p.reportError(id, "+Unsaved", err); exec.placeNew(p, id, id, free, .doc); p.view().active = id; } @@ -731,7 +731,7 @@ pub fn openUnsaved(p: *Pardes, id: usize, content: []u8) void { /// when it has no room at all. pub fn openPager(p: *Pardes, from: usize, dir_arg: []const u8) !usize { const dir = if (dir_arg.len > 0 and dir_arg[0] == '/') dir_arg else p.sessionDir(); - const path = try std.fs.path.join(p.gpa, &.{ dir, "+Pager" }); + const path = try std.Io.Dir.path.join(p.gpa, &.{ dir, "+Pager" }); const free = p.freeSlot() orelse { p.gpa.free(path); return error.NoPaneSlots; |
