mod: use unbuffered streaming writer for TUIs
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 15m36s

This commit is contained in:
2026-06-03 17:39:11 +02:00
parent 24a08e0e62
commit cb262aa51f
18 changed files with 131 additions and 116 deletions
+7 -7
View File
@@ -72,24 +72,24 @@ pub fn main(init: std.process.Init) !void {
}
defer container.deinit(); // also de-initializes the children
try app.start(.full);
defer app.stop() catch |err| log.err("Failed to stop application: {any}", .{err});
try app.start(.full, w);
defer app.stop(w) catch |err| log.err("Failed to stop application: {any}", .{err});
// event loop
while (true) {
const event = app.nextEvent();
const event = try app.nextEvent();
log.debug("received event: {s}", .{@tagName(event)});
// pre event handling
switch (event) {
.key => |key| if (key.eql(.{ .cp = 'c', .mod = .{ .ctrl = true } })) app.quit(),
.key => |key| if (key.eql(.{ .cp = 'c', .mod = .{ .ctrl = true } })) try app.quit(),
// NOTE errors could be displayed in another container in case one was received, etc. to provide the user with feedback
.err => |err| log.err("Received {s} with message: {s}", .{ @errorName(err.err), err.msg }),
else => {},
}
// NOTE returned errors should be propagated back to the application
container.handle(&app.model, event) catch |err| app.postEvent(.{
container.handle(io, &app.model, event) catch |err| try app.postEvent(.{
.err = .{
.err = err,
.msg = "Container Event handling failed",
@@ -102,10 +102,10 @@ pub fn main(init: std.process.Init) !void {
else => {},
}
container.resize(&app.model, try renderer.resize());
container.resize(&app.model, try renderer.resize(w));
container.reposition(&app.model, .{});
try renderer.render(@TypeOf(container), &container, App.Model, &app.model);
try renderer.flush();
try renderer.flush(w);
}
}