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
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 4m26s
This commit is contained in:
110
examples/tui.zig
110
examples/tui.zig
@@ -25,73 +25,49 @@ pub fn main() !void {
|
||||
var renderer: App.Renderer = .{};
|
||||
|
||||
// FIXME: the layout creates an 'incorrect alignment'?
|
||||
var layout = Layout.createFrom(layout: {
|
||||
var layout = Layout.VContainer.init(allocator, .{
|
||||
.{
|
||||
Layout.createFrom(framing: {
|
||||
var framing = Layout.Framing.init(allocator, .{
|
||||
.title = .{
|
||||
.str = "Welcome to my terminal website",
|
||||
.style = .{
|
||||
.ul = .{ .index = 6 },
|
||||
.ul_style = .single,
|
||||
},
|
||||
},
|
||||
}, .{
|
||||
.layout = Layout.createFrom(hcontainer: {
|
||||
var hcontainer = Layout.HContainer.init(allocator, .{
|
||||
.{
|
||||
Widget.createFrom(text: {
|
||||
var text = Widget.Text.init(.left, &[1]Cell{
|
||||
.{ .content = "Yves Biener", .style = .{ .bold = true } },
|
||||
});
|
||||
break :text &text;
|
||||
}),
|
||||
25,
|
||||
},
|
||||
.{
|
||||
Widget.createFrom(text: {
|
||||
var text = Widget.Text.init(.left, &[1]Cell{
|
||||
.{ .content = "File name", .style = .{ .bold = true } },
|
||||
});
|
||||
break :text &text;
|
||||
}),
|
||||
50,
|
||||
},
|
||||
.{
|
||||
Widget.createFrom(text: {
|
||||
var text = Widget.Text.init(.left, &[1]Cell{
|
||||
.{ .content = "Contacts", .style = .{ .bold = true } },
|
||||
});
|
||||
break :text &text;
|
||||
}),
|
||||
25,
|
||||
},
|
||||
});
|
||||
break :hcontainer &hcontainer;
|
||||
}),
|
||||
});
|
||||
break :framing &framing;
|
||||
}),
|
||||
10,
|
||||
},
|
||||
.{
|
||||
Layout.createFrom(margin: {
|
||||
var margin = Layout.Margin.init(allocator, .{ .left = 15, .right = 15 }, .{
|
||||
.widget = Widget.createFrom(text: {
|
||||
var text = Widget.Text.init(.default, &[1]Cell{
|
||||
.{ .content = "Does this change anything", .style = .{ .ul = .default, .ul_style = .single } },
|
||||
});
|
||||
break :text &text;
|
||||
}),
|
||||
});
|
||||
break :margin &margin;
|
||||
}),
|
||||
90,
|
||||
},
|
||||
});
|
||||
break :layout &layout;
|
||||
});
|
||||
var layout = Layout.createFrom(Layout.VContainer.init(allocator, .{
|
||||
.{
|
||||
Layout.createFrom(Layout.Framing.init(allocator, .{
|
||||
.title = .{
|
||||
.str = "Welcome to my terminal website",
|
||||
.style = .{
|
||||
.ul = .{ .index = 6 },
|
||||
.ul_style = .single,
|
||||
},
|
||||
},
|
||||
}, .{
|
||||
.layout = Layout.createFrom(Layout.HContainer.init(allocator, .{
|
||||
.{
|
||||
Widget.createFrom(Widget.Text.init(allocator, .left, &[1]Cell{
|
||||
.{ .content = "Yves Biener", .style = .{ .bold = true } },
|
||||
})),
|
||||
25,
|
||||
},
|
||||
.{
|
||||
Widget.createFrom(Widget.Text.init(allocator, .left, &[1]Cell{
|
||||
.{ .content = "File name", .style = .{ .bold = true } },
|
||||
})),
|
||||
50,
|
||||
},
|
||||
.{
|
||||
Widget.createFrom(Widget.Text.init(allocator, .left, &[1]Cell{
|
||||
.{ .content = "Contacts", .style = .{ .bold = true } },
|
||||
})),
|
||||
25,
|
||||
},
|
||||
})),
|
||||
})),
|
||||
10,
|
||||
},
|
||||
.{
|
||||
Layout.createFrom(Layout.Margin.init(allocator, .{ .left = 15, .right = 15 }, .{
|
||||
.widget = Widget.createFrom(Widget.Text.init(allocator, .default, &[1]Cell{
|
||||
.{ .content = "Does this change anything", .style = .{ .ul = .default, .ul_style = .single } },
|
||||
})),
|
||||
})),
|
||||
90,
|
||||
},
|
||||
}));
|
||||
defer layout.deinit();
|
||||
|
||||
try app.start(null);
|
||||
|
||||
Reference in New Issue
Block a user