mod(memory): do not create items on the stack instead using the provided allocator
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 4m26s

This commit is contained in:
2025-01-06 21:56:04 +01:00
parent 04e1ca087f
commit c2c3f41ff3
21 changed files with 404 additions and 464 deletions

View File

@@ -30,54 +30,44 @@ pub fn main() !void {
// TODO: when not running fullscreen, the application needs to screen down accordingly to display the contents
// -> size hint how much should it use?
var layout = Layout.createFrom(layout: {
var padding = Layout.Padding.init(allocator, .{
.padding = 15,
}, .{
.layout = Layout.createFrom(framing: {
var framing = Layout.Framing.init(
var layout = Layout.createFrom(Layout.Padding.init(allocator, .{
.padding = 15,
}, .{
.layout = Layout.createFrom(Layout.Framing.init(
allocator,
.{
.style = .{
.fg = .{
.index = 6,
},
},
.frame = .round,
.title = .{
.str = "Content in Margin",
.style = .{
.ul_style = .single,
.ul = .{ .index = 6 },
.bold = true,
},
},
},
.{
.layout = Layout.createFrom(Layout.Margin.init(
allocator,
.{
.style = .{
.fg = .{
.index = 6,
},
},
.frame = .round,
.title = .{
.str = "Content in Margin",
.style = .{
.ul_style = .single,
.ul = .{ .index = 6 },
.bold = true,
},
},
.margin = 10,
},
.{
.layout = Layout.createFrom(margin: {
var margin = Layout.Margin.init(
allocator,
.{
.margin = 10,
},
.{
.widget = Widget.createFrom(blk: {
const file = try std.fs.cwd().openFile("./examples/padding.zig", .{});
defer file.close();
var widget = Widget.RawText.init(allocator, file);
break :blk &widget;
}),
},
);
break :margin &margin;
.widget = Widget.createFrom(blk: {
const file = try std.fs.cwd().openFile("./examples/padding.zig", .{});
defer file.close();
break :blk Widget.RawText.init(allocator, file);
}),
},
);
break :framing &framing;
}),
});
break :layout &padding;
});
)),
},
)),
}));
defer layout.deinit();
try app.start(null);