Fixed lossy events.

This commit is contained in:
Izaya 2017-04-19 03:42:25 +10:00
parent 0e269aa894
commit 83ad20cd9d
2 changed files with 3 additions and 2 deletions

View File

@ -7,5 +7,4 @@ function l()
end end
function h(...) function h(...)
computer.pushSignal(...) computer.pushSignal(...)
coroutine.yield()
end end

View File

@ -4,7 +4,9 @@ function readln()
while true do while true do
if ev[1] == "key_down" then if ev[1] == "key_down" then
if ev[3] == 13 then if ev[3] == 13 then
h("display","\127\n") return s h("display","\127\n")
C.yield()
return s
elseif ev[3] == 8 then elseif ev[3] == 8 then
if s:len()>0 then s=s:sub(1,-2) h("display","\127\127|") end if s:len()>0 then s=s:sub(1,-2) h("display","\127\127|") end
elseif ev[3] > 31 and ev[3] < 127 then elseif ev[3] > 31 and ev[3] < 127 then