From 5de9d27458cd8ff7e326532e8923c933e141ea7f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 9 Nov 2026 03:31:33 -0300 Subject: idioms: swallows a caller can decide on, decided: a key a macro or a repeat cannot keep is said (Macro.append returns error{OutOfMemory}), a kind's found rows and list pane say their copy's failure as their fill's, a kind word's value past its pane's 256-byte record is said instead of dropped, and the REPL ask record's two prints, which fit, are unreachable with the reason Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Macro.zig | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/Macro.zig') diff --git a/src/Macro.zig b/src/Macro.zig index b619e523..3688dcf9 100644 --- a/src/Macro.zig +++ b/src/Macro.zig @@ -59,14 +59,11 @@ pub fn deinit(m: *Macro, gpa: std.mem.Allocator) void { /// A typed key, each of its characters one key: what a host delivers as /// one key event with a run of text is that run typed. -pub fn append(list: *std.ArrayList(Stored), gpa: std.mem.Allocator, key: Key) void { +pub fn append(list: *std.ArrayList(Stored), gpa: std.mem.Allocator, key: Key) error{OutOfMemory}!void { const view = std.unicode.Utf8View.init(key.text) catch null; - if (key.text.len == 0 or key.ctrl or key.alt or view == null) { - list.append(gpa, .of(key)) catch {}; - return; - } + if (key.text.len == 0 or key.ctrl or key.alt or view == null) return list.append(gpa, .of(key)); var it = view.?.iterator(); - while (it.nextCodepoint()) |cp| list.append(gpa, .{ .cp = cp, .shift = key.shift }) catch {}; + while (it.nextCodepoint()) |cp| try list.append(gpa, .{ .cp = cp, .shift = key.shift }); } const names = [_]struct { cp: u21, name: []const u8 }{ -- cgit v1.3