summaryrefslogtreecommitdiff
path: root/src/Macro.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-09 03:31:33 -0300
committerGabriel Schneider <[email protected]>2026-11-09 03:31:33 -0300
commit5de9d27458cd8ff7e326532e8923c933e141ea7f (patch)
tree4b6f63dcfbeea1c4727c6790522c645e082ed150 /src/Macro.zig
parent396791f7ca7a03d1cb58a9db35d4d4314ee0c6e9 (diff)
downloadpardes-5de9d27458cd8ff7e326532e8923c933e141ea7f.tar.gz
pardes-5de9d27458cd8ff7e326532e8923c933e141ea7f.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/Macro.zig')
-rw-r--r--src/Macro.zig9
1 files changed, 3 insertions, 6 deletions
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 }{