mod(renderer): dynamic clear of size for widgets to improve render performance
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 35s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 35s
This commit is contained in:
@@ -128,12 +128,19 @@ pub fn Direct(comptime _: bool) type {
|
||||
_ = this;
|
||||
_ = size;
|
||||
}
|
||||
|
||||
pub fn clear(this: *@This(), size: Size) !void {
|
||||
_ = this;
|
||||
const anchor = size.anchor;
|
||||
// NOTE: clear entire screen for the first content (derived from the anchor being at the very left-top)
|
||||
if (anchor.col == 1 and anchor.row == 1) {
|
||||
try terminal.clearScreen();
|
||||
std.debug.assert(1028 > size.cols);
|
||||
var buf: [1028]u8 = undefined;
|
||||
@memset(buf[0..], ' ');
|
||||
for (0..size.rows) |r| {
|
||||
const row: u16 = @truncate(r);
|
||||
try terminal.setCursorPosition(.{
|
||||
.col = size.anchor.col,
|
||||
.row = size.anchor.row + row,
|
||||
});
|
||||
_ = try terminal.write(buf[0..size.cols]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user