Skip to content

Commit c1fd4db

Browse files
committed
Make get_event async
1 parent 210ba04 commit c1fd4db

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/buffer.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function Buffer(rect::Rect, cell::Cell)
2424
end
2525

2626
function Buffer(lines::Vector{String})
27-
2827
height = length(lines)
2928
width = maximum(length(l) for l in lines)
3029
buffer = Buffer(

src/terminal.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ struct Terminal
3131
end
3232
end
3333

34-
get_event(t) = take!(t.stdin_channel)
34+
function get_event(t)
35+
return if isready(t.stdin_channel)
36+
take!(t.stdin_channel)
37+
else
38+
nothing
39+
end
40+
end
3541

3642
function update_channel(t, args...)
3743
for arg in args

0 commit comments

Comments
 (0)