summaryrefslogtreecommitdiff
path: root/src/locations.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/locations.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/locations.zig')
-rw-r--r--src/locations.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/locations.zig b/src/locations.zig
index e8c31bf0..f6a0cf9c 100644
--- a/src/locations.zig
+++ b/src/locations.zig
@@ -51,7 +51,7 @@ pub fn freeRows(gpa: std.mem.Allocator, rows: []Row) void {
/// A copy of `rows` and all they own, gpa's: rows are a blob (File.State
/// `location_rows`), made again rather than written.
-pub fn cloneRows(gpa: std.mem.Allocator, rows: []const Row) ![]Row {
+pub fn cloneRows(gpa: std.mem.Allocator, rows: []const Row) error{OutOfMemory}![]Row {
const out = try gpa.alloc(Row, rows.len);
var made: usize = 0;
errdefer {
@@ -84,7 +84,7 @@ pub fn freeRowList(gpa: std.mem.Allocator, rows: *std.ArrayList(Row)) void {
/// `row` onto a list being built, with copies of its own of the path and
/// the colours it borrows.
-pub fn appendRow(gpa: std.mem.Allocator, rows: *std.ArrayList(Row), row: Row) !void {
+pub fn appendRow(gpa: std.mem.Allocator, rows: *std.ArrayList(Row), row: Row) error{OutOfMemory}!void {
var owned = row;
owned.path = try gpa.dupe(u8, row.path);
errdefer gpa.free(owned.path);
@@ -227,8 +227,8 @@ const Source = struct { path: []const u8, bytes: []const u8 };
/// A file's text as a look from `dir` finds it: an open pane's, unsaved
/// edits and all, else the disk's. Null for a PDF or one not there.
pub fn sourceText(p: *pardes.Pardes, arena: std.mem.Allocator, dir: []const u8, path: []const u8) ?Source {
- if (std.ascii.eqlIgnoreCase(std.fs.path.extension(path), ".pdf")) return null;
- const lexical = std.fs.path.resolvePosix(arena, &.{ dir, path }) catch return null;
+ if (std.ascii.eqlIgnoreCase(std.Io.Dir.path.extension(path), ".pdf")) return null;
+ const lexical = std.Io.Dir.path.resolvePosix(arena, &.{ dir, path }) catch return null;
var pathbuf: [4096]u8 = undefined;
const full = if (filesystem.resolve(p, path, dir, &pathbuf)) |resolved| resolved.path else lexical;
for (p.panes) |slot| if (slot) |pane| {