Obvious refactor of TUI platform's event loop

Signed-off-by: Nick Gravgaard <nick@nickgravgaard.com>
This commit is contained in:
Nick Gravgaard 2022-10-26 11:35:34 +01:00
parent f0b65048cd
commit 3fe270ff88
No known key found for this signature in database
GPG Key ID: 7CC3DB904A0F535E

View File

@ -179,10 +179,9 @@ fn call_the_closure(program: Program) void {
var model = init(&allocator);
const init_viewed = view(model);
print_output(init_viewed);
while (true) {
print_output(view(model));
const line = (stdin.readUntilDelimiterOrEof(buf[0..], '\n') catch unreachable) orelse return;
if (line.len == 1 and line[0] == 'q') {
@ -192,9 +191,6 @@ fn call_the_closure(program: Program) void {
const to_append = RocStr.init(line.ptr, line.len);
model = update(&allocator, model, to_append);
const viewed = view(model);
print_output(viewed);
}
// The closure returns result, nothing interesting to do with it