···18181919pub const Event = union(enum) {
2020 exited,
2121+ redraw,
2122 bell,
2223 title_change,
2324};
···6667// only applies to primary screen
6768scroll_offset: usize = 0,
6869back_mutex: std.Thread.Mutex = .{},
7070+// dirty is protected by back_mutex. Only access this field when you hold that mutex
7171+dirty: bool = false,
69727073unicode: *const vaxis.Unicode,
7174should_quit: bool = false,
···192195 defer self.back_mutex.unlock();
193196 // We keep this as a separate condition so we don't deadlock by obtaining the lock but not
194197 // having sync
195195- if (!self.mode.sync)
198198+ if (!self.mode.sync) {
196199 try self.back_screen.copyTo(&self.front_screen);
200200+ self.dirty = false;
201201+ }
197202 }
198203199204 var row: usize = 0;
···260265 const event = try parser.parseReader(&reader);
261266 self.back_mutex.lock();
262267 defer self.back_mutex.unlock();
268268+269269+ defer if (!self.dirty and self.event_queue.tryPush(.redraw)) {
270270+ self.dirty = true;
271271+ };
263272264273 switch (event) {
265274 .print => |str| {