diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-06 14:39:47 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-06 14:56:36 -0300 |
| commit | e8e7ed956f3914a3790e980df0862b26c30bd611 (patch) | |
| tree | 53d3247c594717f79745ad20c5dd23bf16ed59ea /src/Core.zig | |
| parent | a821fe82d8de3d407ebe104358b97719bd983727 (diff) | |
| download | pardes-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/Core.zig')
| -rw-r--r-- | src/Core.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Core.zig b/src/Core.zig index 775d1e9a..5496a979 100644 --- a/src/Core.zig +++ b/src/Core.zig @@ -1334,16 +1334,16 @@ pub fn saveFailed(p: *Pardes, id: u8, path: []const u8, err: anyerror) void { // The `-%` spelling fs.zig already uses for "make this dirty". f.saved_revision = f.revision -% 1; }; - var what: [limits.host_path_cap + 32]u8 = undefined; + var what: pardes.Kind.Buf(limits.host_path_cap + 32) = .{}; // A write into a directory that is not there: said so, in the words // a mount reads as ENOENT; EACCES when one above refuses. const parent = parentTrouble(path, err); if (parent.denied) - p.reportFailure(id, std.fmt.bufPrint(&what, "Save {s}: permission denied", .{path[0..@min(path.len, limits.host_path_cap)]}) catch unreachable) // cap + 24 fits cap + 32 + p.reportFailure(id, what.print("Save {s}: permission denied", .{path[0..@min(path.len, limits.host_path_cap)]})) else if (parent.missing) - p.reportFailure(id, std.fmt.bufPrint(&what, "Save {s}: no such directory", .{path[0..@min(path.len, limits.host_path_cap)]}) catch unreachable) // cap + 24 fits cap + 32 + p.reportFailure(id, what.print("Save {s}: no such directory", .{path[0..@min(path.len, limits.host_path_cap)]})) else - p.reportError(id, std.fmt.bufPrint(&what, "Save {s}", .{path[0..@min(path.len, limits.host_path_cap)]}) catch unreachable, err); // cap + 5 fits cap + 32 + p.reportError(id, what.print("Save {s}", .{path[0..@min(path.len, limits.host_path_cap)]}), err); p.noteLateFailure(id); } @@ -1733,8 +1733,8 @@ pub fn windowOpacityDone(p: *Pardes, applied: u8, failure: ?[]const u8) void { // Do not claim a value the compositor refused; an explicit retry of // the same command will arm a new request. p.settings.window_opacity = applied; - var buf: [240 + 16]u8 = undefined; - p.setMessage(p.view().active, std.fmt.bufPrint(&buf, "WindowOpacity: {s}", .{reason[0..@min(reason.len, 240)]}) catch unreachable); // 240 + 15 fits 240 + 16 + var buf: pardes.Kind.Buf(240 + 16) = .{}; + p.setMessage(p.view().active, buf.print("WindowOpacity: {s}", .{reason})); } /// Recompute geometry, push grid-size changes to each emulator and pty, |
