fix: render cursor correctly in case the same character remains the cursor position
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 47s
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 47s
This commit is contained in:
@@ -96,12 +96,18 @@ pub const Buffered = struct {
|
|||||||
const idx = (row * this.size.x) + col;
|
const idx = (row * this.size.x) + col;
|
||||||
const cs = s[idx];
|
const cs = s[idx];
|
||||||
const cvs = vs[idx];
|
const cvs = vs[idx];
|
||||||
if (cs.eql(cvs)) continue;
|
|
||||||
|
|
||||||
if (cvs.style.cursor) cursor_position = .{
|
// update the latest found cursor position
|
||||||
|
if (cvs.style.cursor) {
|
||||||
|
assert(cursor_position == null);
|
||||||
|
cursor_position = .{
|
||||||
.x = @truncate(col),
|
.x = @truncate(col),
|
||||||
.y = @truncate(row),
|
.y = @truncate(row),
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cs.eql(cvs)) continue;
|
||||||
|
|
||||||
// render differences found in virtual screen
|
// render differences found in virtual screen
|
||||||
try terminal.setCursorPosition(.{ .y = @truncate(row), .x = @truncate(col) });
|
try terminal.setCursorPosition(.{ .y = @truncate(row), .x = @truncate(col) });
|
||||||
try cvs.value(writer);
|
try cvs.value(writer);
|
||||||
@@ -118,6 +124,7 @@ pub const Buffered = struct {
|
|||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const meta = std.meta;
|
const meta = std.meta;
|
||||||
|
const assert = std.debug.assert;
|
||||||
const Allocator = std.mem.Allocator;
|
const Allocator = std.mem.Allocator;
|
||||||
const terminal = @import("terminal.zig");
|
const terminal = @import("terminal.zig");
|
||||||
const Cell = @import("cell.zig");
|
const Cell = @import("cell.zig");
|
||||||
|
|||||||
Reference in New Issue
Block a user