···166166}
167167168168pub fn draw(self: *Terminal, win: vaxis.Window) !void {
169169- if (self.back_mutex.tryLock() and !self.mode.sync) {
169169+ if (self.back_mutex.tryLock()) {
170170 defer self.back_mutex.unlock();
171171- try self.back_screen.copyTo(&self.front_screen);
171171+ // We keep this as a separate condition so we don't deadlock by obtaining the lock but not
172172+ // having sync
173173+ if (!self.mode.sync)
174174+ try self.back_screen.copyTo(&self.front_screen);
172175 }
173176174177 var row: usize = 0;