summaryrefslogtreecommitdiff
path: root/src/Dir.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 12:40:11 -0300
committerGabriel Schneider <[email protected]>2026-11-06 14:56:36 -0300
commita66a9eb6e0c69cfcb63717bc27704cdc96f382b4 (patch)
tree400e3034a6c71c1d15d0ad302e1293a4290071b9 /src/Dir.zig
parent36a51ddc67d0beb7d9851fb2425cf780a47fed36 (diff)
downloadpardes-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/Dir.zig')
-rw-r--r--src/Dir.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Dir.zig b/src/Dir.zig
index d8d4d9b0..65e18c1a 100644
--- a/src/Dir.zig
+++ b/src/Dir.zig
@@ -39,7 +39,7 @@ pub fn ofName(name: []const u8) []const u8 {
const dir = std.mem.trimEnd(u8, name, "/");
return if (dir.len == 0) "/" else dir;
}
- return std.fs.path.dirname(name) orelse "/";
+ return std.Io.Dir.path.dirname(name) orelse "/";
}
/// The entries of directory `dir` on this host as acme lists them
@@ -105,7 +105,7 @@ fn readHost(gpa: std.mem.Allocator, local: []const u8) ![]u8 {
/// first, every column as wide as the widest entry and a cell more,
/// rounded up to a tab, and each row ending in a newline. Blanks pad where
/// acme's tabs do: a pardes tab is a fixed width, not a stop.
-pub fn columnate(gpa: std.mem.Allocator, entries: []const []const u8, width: usize) ![]u8 {
+pub fn columnate(gpa: std.mem.Allocator, entries: []const []const u8, width: usize) error{OutOfMemory}![]u8 {
var colw: usize = 0;
for (entries) |entry| {
const w = File.displayWidth(entry) + 1;
@@ -194,7 +194,7 @@ pub fn look(p: *Pardes, from: usize, dir: []const u8) void {
return show(p, from, i);
}
var said: [limits.host_path_cap + 16]u8 = undefined;
- const what = std.fmt.bufPrint(&said, "look: {s}", .{name[0..@min(name.len, limits.host_path_cap)]}) catch "look";
+ const what = std.fmt.bufPrint(&said, "look: {s}", .{name[0..@min(name.len, limits.host_path_cap)]}) catch unreachable; // cap and 6 fit
const names = read(p.gpa, dir) catch |err| {
p.gpa.free(name);
return p.reportError(from, what, err);
@@ -240,7 +240,7 @@ pub fn show(p: *Pardes, from: usize, id: usize) void {
const serial = pane.serial;
var said: [limits.host_path_cap + 16]u8 = undefined;
const name = pane.file.?.path;
- const what = std.fmt.bufPrint(&said, "look: {s}", .{name[0..@min(name.len, limits.host_path_cap)]}) catch "look";
+ const what = std.fmt.bufPrint(&said, "look: {s}", .{name[0..@min(name.len, limits.host_path_cap)]}) catch unreachable; // cap and 6 fit
refresh(p, id) catch |err| return p.reportError(from, what, err);
// Closed while the turn was out: nothing to give the keyboard to.
const now = p.panes[id] orelse return;