mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-21 15:59:20 +03:00
Obvious refactor of TUI platform's event loop
Signed-off-by: Nick Gravgaard <nick@nickgravgaard.com>
This commit is contained in:
parent
f0b65048cd
commit
3fe270ff88
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user