mod(renderer): store absolut screen size for view change to report current screen size accordingly
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m21s

This commit is contained in:
2025-01-14 17:08:19 +01:00
parent 3048b59e84
commit 2efbb5feb1
2 changed files with 7 additions and 2 deletions

View File

@@ -131,6 +131,8 @@ pub fn main() !void {
switch (e) {
.tui => {
view = tui_view;
// NOTE: report potentially new screen size
view.handle(.{ .resize = renderer.size });
},
}
},

View File

@@ -19,13 +19,16 @@ pub fn Direct(comptime fullscreen: bool) type {
_ = log;
_ = fullscreen;
return struct {
size: Size,
pub fn resize(this: *@This(), size: Size) void {
_ = this;
_ = size;
this.size = size;
}
pub fn clear(this: *@This(), size: Size) !void {
_ = this;
// NOTE: clear on the entire screen may introduce too much overhead and could instead clear the entire screen instead.
// - it could also then try to optimize for further *clear* calls, that result in pretty much a nop? -> how to identify those clear calls?
// TODO: this should instead by dynamic and correct of size (terminal could be too large currently)
std.debug.assert(1028 > size.cols);
var buf: [1028]u8 = undefined;