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/Pipe.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Pipe.zig') diff --git a/src/Pipe.zig b/src/Pipe.zig index 87768f22..a02b9214 100644 --- a/src/Pipe.zig +++ b/src/Pipe.zig @@ -301,7 +301,7 @@ pub fn pipeResponse( const cut = pipeCut(&wait, content, i) orelse return; const output = pipeOutput(&wait, outputs, content, i); if (output.len > selection_pipe.max_stdout_bytes) return; - total_output = std.math.add(usize, total_output, output.len) catch unreachable; // both are capped far below a usize's room + total_output = std.math.add(usize, total_output, output.len) catch return; // past any cap if (total_output > selection_pipe.max_total_stdout_bytes) return; if (i > 0 and cut.lo < ops[i - 1].q1) return; ops[i] = .{ .q0 = @intCast(cut.lo), .q1 = @intCast(cut.hi), .text = output }; -- cgit v1.3