feat(element): parameter *const App.Model
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 55s

The renderer will provide `resize`, `reposition` and `minSize` (for
the `Scrollable` `Element`) with a read-only pointer to the model of
the application (similar to how it is already done for `handle` and
`content`). Every interface function now has the same data that it can
each use for implementing its corresponding task based on local and
shared variables through the element instance and model pointer.
This commit is contained in:
2025-11-10 17:09:29 +01:00
parent 79a0d17a66
commit 38d31fae72
19 changed files with 86 additions and 84 deletions

View File

@@ -89,8 +89,8 @@ pub fn main() !void {
else => {},
}
container.resize(try renderer.resize());
container.reposition(.{});
container.resize(&app.model, try renderer.resize());
container.reposition(&app.model, .{});
try renderer.render(@TypeOf(container), &container, App.Model, &app.model);
try renderer.flush();
}

View File

@@ -117,7 +117,7 @@ const TextStyles = struct {
};
}
fn minSize(ctx: *anyopaque, size: zterm.Point) zterm.Point {
fn minSize(ctx: *anyopaque, _: *const App.Model, size: zterm.Point) zterm.Point {
_ = ctx;
_ = size;
return .{
@@ -253,8 +253,8 @@ pub fn main() !void {
}
}
container.resize(try renderer.resize());
container.reposition(.{});
container.resize(&app.model, try renderer.resize());
container.reposition(&app.model, .{});
try renderer.render(@TypeOf(container), &container, App.Model, &app.model);
try renderer.flush();
}