From 12ce9744d19a1553639db8433b9deb91d5698d81 Mon Sep 17 00:00:00 2001 From: Marto Date: Wed, 12 Feb 2025 01:40:43 +0100 Subject: [PATCH] fixes --- src/interaction.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interaction.zig b/src/interaction.zig index f6c63a6..744a5e1 100644 --- a/src/interaction.zig +++ b/src/interaction.zig @@ -7,9 +7,9 @@ const InteractionError = error{ pub fn userInteraction(allocator: std.mem.Allocator, tasks: *std.ArrayList([]const u8)) !void { var failure: usize = 0; - try clearTerminal(); while (failure < 3) { + try clearTerminal(); printItems(tasks) catch |err| { std.debug.print("Failed to print the items:\n{}\n", .{err}); failure += 1; @@ -21,9 +21,10 @@ pub fn userInteraction(allocator: std.mem.Allocator, tasks: *std.ArrayList([]con continue; }; defer allocator.free(input); + // todo add option to manipulate tasks via numbers (and add numbers to tasks) const Case = enum { add, edit, remove, quit }; - const case = std.meta.stringToEnum(Case, input) orelse return; + const case = std.meta.stringToEnum(Case, input) orelse continue; var task_name: []const u8 = undefined; @@ -71,7 +72,6 @@ pub fn userInteraction(allocator: std.mem.Allocator, tasks: *std.ArrayList([]con }, .quit => break, } - try clearTerminal(); } }