summaryrefslogtreecommitdiff
path: root/src/File.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 01:09:05 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commitf48ab559a4d257137a3aae987a4962f9d74ede23 (patch)
tree99b233f7386673ee7a84031f4e5ff1b3011adae0 /src/File.zig
parentfb72c2402fa1b1ae99be64fe7b2947ea5dd42623 (diff)
downloadpardes-f48ab559a4d257137a3aae987a4962f9d74ede23.tar.gz
pardes-f48ab559a4d257137a3aae987a4962f9d74ede23.zip
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 <[email protected]>
Diffstat (limited to 'src/File.zig')
-rw-r--r--src/File.zig2
1 files changed, 1 insertions, 1 deletions
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;