From f48ab559a4d257137a3aae987a4962f9d74ede23 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 01:09:05 -0300 Subject: Have Text.pane return nothing for a header instead of trapping A column's or the workspace's tag has no pane, and asking one for it hit unreachable; every caller guarded against that by checking `what` first. An optional makes each caller say what it does without a pane, so a forgotten guard no longer compiles into a crash. Co-Authored-By: Claude Opus 5.5 --- src/File.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/File.zig') diff --git a/src/File.zig b/src/File.zig index 262f3ebb..af538385 100644 --- a/src/File.zig +++ b/src/File.zig @@ -655,7 +655,7 @@ pub fn cursorLines(arena: std.mem.Allocator, pane: *Pane, f: *State) ![]const [] /// Edit-buffer fragments and other temporary text retain modal's scan path. fn contentIndex(t: *Text, text: []const u8) ?[]const usize { if (t.what != .body) return null; - const pane = t.pane(); + const pane = t.pane() orelse return null; const f = if (pane.file) |*file| file else return null; if (text.ptr != f.content.ptr or text.len != f.content.len) return null; return lineIndex(pane.gpa, f) catch null; -- cgit v1.3