mod(app): remove interupt method, merged with stop
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m13s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m13s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const QuitText = struct {
|
||||
const text = "Press ctrl+c to quit.";
|
||||
const text = "Press ctrl+c or ctrl+d to quit.";
|
||||
|
||||
pub fn element(this: *@This()) App.Element {
|
||||
return .{
|
||||
@@ -142,13 +142,16 @@ pub fn main() !void {
|
||||
|
||||
// handle events
|
||||
for (0..len) |_| {
|
||||
const event = app.queue.pop();
|
||||
const event = app.queue.drain().?;
|
||||
log.debug("received event: {s}", .{@tagName(event)});
|
||||
|
||||
// pre event handling
|
||||
switch (event) {
|
||||
// NOTE draw the character with the ctrl indication and a newline to make sure the rendering stays consistent
|
||||
.cancel => try renderer.writeCtrlDWithNewline(),
|
||||
.cancel => {
|
||||
app.quit();
|
||||
break :event;
|
||||
},
|
||||
.line => |line| {
|
||||
defer gpa.free(line);
|
||||
log.debug("{s}", .{line});
|
||||
@@ -165,15 +168,7 @@ pub fn main() !void {
|
||||
.msg = "Container Event handling failed",
|
||||
},
|
||||
});
|
||||
|
||||
// post event handling
|
||||
switch (event) {
|
||||
.quit => break :event,
|
||||
else => {},
|
||||
}
|
||||
}
|
||||
// if there are more events to process continue handling them otherwise I can render the next frame
|
||||
if (app.queue.len() > 0) continue :event;
|
||||
|
||||
container.resize(&app.model, try renderer.resize());
|
||||
container.reposition(&app.model, .{});
|
||||
|
||||
Reference in New Issue
Block a user