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
This commit is contained in:
parent
052ff24c2f
commit
84cd9fdebe
1 changed files with 2 additions and 1 deletions
|
@ -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 {
|
pub fn stop(self: *Self) void {
|
||||||
self.should_quit = true;
|
self.should_quit = true;
|
||||||
// trigger a read
|
// trigger a read
|
||||||
|
@ -59,6 +59,7 @@ pub fn Loop(comptime T: type) type {
|
||||||
if (self.thread) |thread| {
|
if (self.thread) |thread| {
|
||||||
thread.join();
|
thread.join();
|
||||||
self.thread = null;
|
self.thread = null;
|
||||||
|
self.should_quit = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue