summaryrefslogtreecommitdiff
path: root/src/sam_edit.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
commit80f4398f1fed8d46d73cab8045005c02189b34fc (patch)
treead60d6e83a1ba08d9869012ac819ff58ca826248 /src/sam_edit.zig
parenta864ef66736d3cfbdffed8b98a3c46be7985db74 (diff)
downloadpardes-80f4398f1fed8d46d73cab8045005c02189b34fc.tar.gz
pardes-80f4398f1fed8d46d73cab8045005c02189b34fc.zip
idioms #14, the rest: wire's has_cell_pixels (@hasField on a struct that always has the field) goes with its comptime branches, syntax's predicate ops are a stringToEnum switch, the public surfaces of sam_edit, locations, Names, Macro, selection_pipe, recent and builtins_json name their sets (OutOfMemory, Writer.Error), and std.fs.path and max_path_bytes are std.Io.Dir's
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/sam_edit.zig')
-rw-r--r--src/sam_edit.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/sam_edit.zig b/src/sam_edit.zig
index a6ed5772..3886f9eb 100644
--- a/src/sam_edit.zig
+++ b/src/sam_edit.zig
@@ -670,8 +670,8 @@ const Exec = struct {
var home: [4096]u8 = undefined;
const name = try ex.arena.dupe(u8, @import("fs.zig").expandHome(name_in, &home));
if (name.len > 0 and name[0] == '/') return name;
- const dir = std.fs.path.dirnamePosix(ex.files.items[fi].name) orelse "/";
- return std.fs.path.resolvePosix(ex.arena, &.{ dir, name });
+ const dir = std.Io.Dir.path.dirnamePosix(ex.files.items[fi].name) orelse "/";
+ return std.Io.Dir.path.resolvePosix(ex.arena, &.{ dir, name });
}
/// The open file named `path`, a scratch too.
@@ -1034,7 +1034,7 @@ const Exec = struct {
/// The text after `ops`, which are in order and do not overlap (a job's
/// with its output in place).
-pub fn apply(gpa: std.mem.Allocator, text: []const u8, ops: []const Op) ![]u8 {
+pub fn apply(gpa: std.mem.Allocator, text: []const u8, ops: []const Op) error{OutOfMemory}![]u8 {
var n: usize = text.len;
for (ops) |o| n = n - (o.q1 - o.q0) + o.text.len;
const out = try gpa.alloc(u8, n);