From 84cd9fdebe6fd1d6d42348bb8478a1963fe76aa5 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Mon, 3 Jun 2024 07:36:12 -0500 Subject: [PATCH] fix(loop): fix stopping and starting of loop When stopping the loop, we never reset `should_quit` which caused the program to not read any input if the loop were started again --- src/Loop.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Loop.zig b/src/Loop.zig index 85efd22..4c1ecd6 100644 --- a/src/Loop.zig +++ b/src/Loop.zig @@ -50,7 +50,7 @@ pub fn Loop(comptime T: type) type { }); } - /// stops reading from the tty and returns it to it's initial state + /// stops reading from the tty. pub fn stop(self: *Self) void { self.should_quit = true; // trigger a read @@ -59,6 +59,7 @@ pub fn Loop(comptime T: type) type { if (self.thread) |thread| { thread.join(); self.thread = null; + self.should_quit = false; } }