From 2b9ab1e0fbdc2d2ad8647bb5f530ff22df34f5c3 Mon Sep 17 00:00:00 2001 From: Yves Biener Date: Wed, 5 Mar 2025 23:22:06 +0100 Subject: [PATCH] fix(example/styles): provide necessary size for text display through the element This could also be done through the `resize` function interface of the `Element` or the corresponding `Container` from the outside (as done in this example - as the size is know at compile-time). --- examples/styles/text.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/styles/text.zig b/examples/styles/text.zig index 38f3c7a..331894d 100644 --- a/examples/styles/text.zig +++ b/examples/styles/text.zig @@ -111,6 +111,12 @@ pub fn main() !void { var box = try App.Container.init(allocator, .{ .layout = .{ .direction = .vertical }, + .size = .{ + .dim = .{ + .x = std.meta.fields(zterm.Style.Emphasis).len * TextStyles.text.len, + .y = (std.meta.fields(zterm.Color).len - 1) * (std.meta.fields(zterm.Color).len - 2), + }, + }, }, text_styles.element()); defer box.deinit();