diff --git a/src/app.zig b/src/app.zig index 9acc49e..4e9dc86 100644 --- a/src/app.zig +++ b/src/app.zig @@ -178,10 +178,9 @@ pub fn App(comptime M: type, comptime E: type) type { else => |e| return e, }; } + var remaining_bytes: usize = 0; while (true) { this.quit_event.timedWait(20 * std.time.ns_per_ms) catch { - var remaining_bytes: usize = 0; - // non-blocking read const read_bytes = terminal.read(buf[remaining_bytes..]) catch |err| switch (err) { error.WouldBlock => { @@ -191,6 +190,7 @@ pub fn App(comptime M: type, comptime E: type) type { }, else => return err, } + remaining_bytes; + remaining_bytes = 0; // escape key presses if (buf[0] == 0x1b and read_bytes > 1) {