From e8e7ed956f3914a3790e980df0862b26c30bd611 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 14:39:47 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Output.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Output.zig') diff --git a/src/Output.zig b/src/Output.zig index ceffa7d9..384bb500 100644 --- a/src/Output.zig +++ b/src/Output.zig @@ -770,14 +770,14 @@ pub fn dropUnsaved(p: *Pardes, gone: *const Pane) void { const o = rf.output orelse continue; if (o.from != .unsaved) continue; var scratch_name: [limits.host_path_cap + 24]u8 = undefined; - const as_scratch = std.fmt.bufPrint(&scratch_name, "{s} (pane {d}): Modified", .{ gf.path, gone.serial }) catch ""; + const as_scratch = std.fmt.bufPrint(&scratch_name, "{s} (pane {d}): Modified", .{ gf.path, gone.serial }) catch null; var out: std.ArrayList(u8) = .empty; var lines = std.mem.splitScalar(u8, rf.content, '\n'); var dropped = false; var first = true; while (lines.next()) |line| { const is_it = std.mem.startsWith(u8, line, gf.path) and std.mem.eql(u8, line[gf.path.len..], ": Modified"); - if (is_it or (as_scratch.len > 0 and std.mem.eql(u8, line, as_scratch))) { + if (is_it or (as_scratch != null and std.mem.eql(u8, line, as_scratch.?))) { dropped = true; continue; } -- cgit v1.3