summaryrefslogtreecommitdiff
path: root/src/tagline.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 12:42:32 -0300
committerGabriel Schneider <[email protected]>2026-11-06 14:56:36 -0300
commit34a80c9f9b81b64d095a1d5123ae74a52bef4749 (patch)
tree618eb5f3d1bd04e659ba6389977d017aff4f4033 /src/tagline.zig
parent9b60771ffcd254772b716fafe488b09d9c2d3e0c (diff)
downloadpardes-34a80c9f9b81b64d095a1d5123ae74a52bef4749.tar.gz
pardes-34a80c9f9b81b64d095a1d5123ae74a52bef4749.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/tagline.zig')
-rw-r--r--src/tagline.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tagline.zig b/src/tagline.zig
index 28cd2a9b..a364732a 100644
--- a/src/tagline.zig
+++ b/src/tagline.zig
@@ -81,7 +81,7 @@ pub fn revealHeader(p: *Pardes) void {
v.header_top = 0;
return;
};
- const text = edit.flatSurface(p, t) catch return;
+ const text = edit.flatSurface(p, t) catch unreachable; // a header's text is its own (flatSurface makes none)
const cur: usize = @intCast(@max(0, t.cur_row));
const rows: usize = if (p.headerColumn() != null) layout.columnBarHeight(p) else p.topBarHeight();
if (cur < v.header_top) v.header_top = cur;
@@ -211,7 +211,7 @@ pub fn tagText(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) ![]u8 {
/// it starts on Save, so that `:` and the execute key write the file.
pub fn enterTag(p: *Pardes, pane: *Pane) void {
const t = &pane.tag;
- const whole = tagText(p, p.scratch.allocator(), pane) catch return;
+ const whole = tagText(p, p.scratch.allocator(), pane) catch |err| return p.reportError(p.view().active, "tag", err);
if (!t.cur_pinned) {
// Save is looked for in the tag's own text, after the prefix.
const lead = whole.len - curTail(pane).len;
@@ -365,7 +365,7 @@ pub fn typedIntoName(p: *Pardes, pane: *Pane, key: pardes.Key) bool {
pub fn draftName(p: *Pardes, pane: *Pane, col: usize) void {
const f = pane.file orelse return;
if (!panes.Output.fileTraits(f.output).saves) return;
- const name = p.gpa.dupe(u8, f.path) catch return;
+ const name = p.gpa.dupe(u8, f.path) catch |err| return p.reportError(p.view().active, "name", err);
pane.closePrompt();
pane.prompt = .name;
pane.prompt_view = p.live;
@@ -415,7 +415,7 @@ pub fn enterHeader(p: *Pardes, column: ?usize) void {
p.view().header = if (column) |c| .{ .column = c } else .workspace;
if (column) |c| p.setActiveColumn(c);
const t = focusedHeader(p) orelse return exitHeader(p);
- takeKeyboard(t, edit.flatSurface(p, t) catch "");
+ takeKeyboard(t, edit.flatSurface(p, t) catch unreachable); // a header's text is its own
}
/// The span a header's selection covers on line `row` of its text, in
@@ -443,7 +443,7 @@ pub fn workspaceBlank(p: *Pardes, col: u16, row: u16, tag_hit: ?pardes.TagHit) b
const v = p.view();
if (row >= p.topBarHeight() or col >= v.screen_w) return false;
if (col < TAG_TEXT_INSET) return true;
- const text = edit.flatSurface(p, &p.global_tag) catch return false;
+ const text = edit.flatSurface(p, &p.global_tag) catch unreachable; // a header's text is its own
const scroll: usize = if (v.header != null and p.headerColumn() == null) v.header_scroll else 0;
const at = @as(usize, Layer.columnAt(p, .workspace, 0, tag_hit, false, 0) orelse (col - TAG_TEXT_INSET)) + scroll;
return at >= panes.File.displayWidth(modal.lineSlice(text, 0)) + 2;