From 34a80c9f9b81b64d095a1d5123ae74a52bef4749 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 12:42:32 -0300 Subject: idioms #17, the rest of the core says its failures: tagline, keys, panes, Effect and the header text in mouse report a failed allocation or shell where they returned with nothing said, the headers' own text (flatSurface makes none) and the prints whose buffer provably fits (layout, modal, panes, keys, colors) catch unreachable with why Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/mouse.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mouse.zig') diff --git a/src/mouse.zig b/src/mouse.zig index 8e50478f..936e504d 100644 --- a/src/mouse.zig +++ b/src/mouse.zig @@ -97,7 +97,7 @@ fn headerPoint(p: *Pardes, column: ?usize, mcol: u16, mrow: u16, clamp: bool) ?s const t = if (column) |c| &v.col_tags[c] else &p.global_tag; const x = if (column) |c| v.col_x[c] + TAG_TEXT_INSET else TAG_TEXT_INSET; const focused = v.header != null and p.headerColumn() == column; - const text = edit.flatSurface(p, t) catch return null; + const text = edit.flatSurface(p, t) catch unreachable; // a header's text is its own const base = if (column != null) p.topBarHeight() else 0; const rows = if (column != null) layout.columnBarHeight(p) else p.topBarHeight(); const row: u16 = if (clamp) @min(mrow -| base, rows -| 1) else mrow -| base; @@ -118,7 +118,7 @@ fn headerSweepRun(p: *Pardes, sweep: HeaderSweep) void { const v = p.view(); const column = sweep.column(p) catch return; // error.Gone: its column closed under the sweep const t = if (column) |c| &v.col_tags[c] else &p.global_tag; - const text = edit.flatSurface(p, t) catch |err| return p.reportError(v.active, "edit", err); + const text = edit.flatSurface(p, t) catch unreachable; // a header's text is its own const swept = sweep.span(text.len); const selected = if (swept.lo < swept.hi) text[swept.lo..swept.hi] else click: { const line = std.mem.count(u8, text[0..swept.lo], "\n"); -- cgit v1.3