fix(widget): respect size for RawText and Spacer Widgets
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 36s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 36s
This commit is contained in:
@@ -11,6 +11,8 @@ pub fn Widget(comptime Event: type, comptime Renderer: type) type {
|
||||
@compileError("Provided user event `Event` for `Layout(comptime Event: type)` is not of type `union(enum)`.");
|
||||
}
|
||||
return struct {
|
||||
size: terminal.Size = undefined,
|
||||
|
||||
pub fn init() @This() {
|
||||
return .{};
|
||||
}
|
||||
@@ -20,15 +22,17 @@ pub fn Widget(comptime Event: type, comptime Renderer: type) type {
|
||||
}
|
||||
|
||||
pub fn handle(this: *@This(), event: Event) ?Event {
|
||||
_ = this;
|
||||
_ = event;
|
||||
switch (event) {
|
||||
.resize => |size| {
|
||||
this.size = size;
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
pub fn render(this: *@This(), renderer: Renderer) !void {
|
||||
// FIX: this should rather clear the `terminal.Size` provided through the event system using the _renderer_.
|
||||
_ = this;
|
||||
_ = renderer;
|
||||
try renderer.clear(this.size);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user