summaryrefslogtreecommitdiff
path: root/src/Macro.zig
diff options
context:
space:
mode:
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 }{