diff --git a/src/render.zig b/src/render.zig index e8c36f8..d0e56cc 100644 --- a/src/render.zig +++ b/src/render.zig @@ -96,12 +96,18 @@ pub const Buffered = struct { const idx = (row * this.size.x) + col; const cs = s[idx]; const cvs = vs[idx]; + + // update the latest found cursor position + if (cvs.style.cursor) { + assert(cursor_position == null); + cursor_position = .{ + .x = @truncate(col), + .y = @truncate(row), + }; + } + if (cs.eql(cvs)) continue; - if (cvs.style.cursor) cursor_position = .{ - .x = @truncate(col), - .y = @truncate(row), - }; // render differences found in virtual screen try terminal.setCursorPosition(.{ .y = @truncate(row), .x = @truncate(col) }); try cvs.value(writer); @@ -118,6 +124,7 @@ pub const Buffered = struct { const std = @import("std"); const meta = std.meta; +const assert = std.debug.assert; const Allocator = std.mem.Allocator; const terminal = @import("terminal.zig"); const Cell = @import("cell.zig");