summaryrefslogtreecommitdiff
path: root/src/File.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 14:39:47 -0300
committerGabriel Schneider <[email protected]>2026-11-06 14:56:36 -0300
commite8e7ed956f3914a3790e980df0862b26c30bd611 (patch)
tree53d3247c594717f79745ad20c5dd23bf16ed59ea /src/File.zig
parenta821fe82d8de3d407ebe104358b97719bd983727 (diff)
downloadpardes-e8e7ed956f3914a3790e980df0862b26c30bd611.tar.gz
pardes-e8e7ed956f3914a3790e980df0862b26c30bd611.zip
idioms #20, the bound in the type or the cut handled: of the 166 `catch unreachable` the pass kept, 64 stay where a reader checks the bound without arithmetic (an integer's digits, a declared field's size, and now the daemon's pid lists and the clock's two-digit fields written in their types), 69 texts print through Kind.Buf at their old size, 31 handle the failure once (a print into ename cut at its 320, paneText's line cut where its buffer fills, a log record or mouse report dropped rather than cut short, the question's letters that fit), Newcol's and pane/new's refusals are comptime strings, and dropUnsaved's too-long scratch name is null, not an empty sentinel
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/File.zig')
-rw-r--r--src/File.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/File.zig b/src/File.zig
index 1c40379d..1e553bc9 100644
--- a/src/File.zig
+++ b/src/File.zig
@@ -1511,8 +1511,8 @@ pub fn deleted(p: *Pardes, id: u8) void {
const f = if (pane.file) |*file| file else return;
if (f.disk_gone) return;
f.disk_gone = true;
- var said: [limits.host_path_cap + 64]u8 = undefined;
- p.setMessage(id, std.fmt.bufPrint(&said, "{s} deleted on disk (Save writes it again)", .{f.path[0..@min(f.path.len, limits.host_path_cap)]}) catch unreachable); // cap + 52 fits cap + 64
+ var said: pardes.Kind.Buf(limits.host_path_cap + 64) = .{};
+ p.setMessage(id, said.print("{s} deleted on disk (Save writes it again)", .{f.path[0..@min(f.path.len, limits.host_path_cap)]}));
var rec: [32]u8 = undefined;
pardes.ctlfs.events.notePath(p, "changed", std.fmt.bufPrint(&rec, "{d} deleted", .{pane.serial}) catch unreachable); // a u32 fits 32
}
@@ -1538,8 +1538,8 @@ pub fn changed(p: *Pardes, id: u8, bytes: []const u8) void {
if (f.disk_newer == disk) return;
f.disk_newer = disk;
f.disk_newer_warned = false;
- var said: [limits.host_path_cap + 64]u8 = undefined;
- p.setMessage(id, std.fmt.bufPrint(&said, "{s} changed on disk (get reloads it, Save overwrites it)", .{f.path[0..@min(f.path.len, limits.host_path_cap)]}) catch unreachable); // cap + 52 fits cap + 64
+ var said: pardes.Kind.Buf(limits.host_path_cap + 64) = .{};
+ p.setMessage(id, said.print("{s} changed on disk (get reloads it, Save overwrites it)", .{f.path[0..@min(f.path.len, limits.host_path_cap)]}));
var rec: [16]u8 = undefined;
pardes.ctlfs.events.notePath(p, "changed", std.fmt.bufPrint(&rec, "{d}", .{pane.serial}) catch unreachable); // a u32 fits 16
return;