there is now a 100ms timeout so it shouldn't get stuck in escape mode for more than 100ms **ever**
This commit is contained in:
parent
4331bdf482
commit
b16fa6aeb7
@ -110,15 +110,17 @@ function computer.signalTransformers.key_down(s, a, ascii, key, user)
|
||||
return s, a, ascii, key, user
|
||||
end
|
||||
if ascii == 27 then
|
||||
inesc_down = true
|
||||
inesc_down = native.uptime() / 1000
|
||||
return nil
|
||||
elseif inesc_down then
|
||||
if (ascii < 48 or ascii > 57) and ascii ~= 59 and ascii ~= 91 then
|
||||
inesc_down = false
|
||||
key = escmap[ascii] or 0
|
||||
ascii = 0
|
||||
else
|
||||
elseif native.uptime() - inesc_down > 100 then -- 100ms timeout after {ESC}
|
||||
return nil
|
||||
else
|
||||
inesc_down = false
|
||||
end
|
||||
end
|
||||
return s, a, math.floor(asciitr[ascii] or ascii), keymap[ascii] or key, user
|
||||
@ -130,15 +132,17 @@ function computer.signalTransformers.key_up(s, a, ascii, key, user)
|
||||
return s, a, ascii, key, user
|
||||
end
|
||||
if ascii == 27 then
|
||||
inesc_up = true
|
||||
inesc_up = native.uptime() / 1000
|
||||
return nil
|
||||
elseif inesc_up then
|
||||
if (ascii < 48 or ascii > 57) and ascii ~= 59 and ascii ~= 91 then
|
||||
inesc_up = false
|
||||
key = escmap[ascii] or 0
|
||||
ascii = 0
|
||||
else
|
||||
elseif native.uptime() - inesc_up > 100 then -- 100ms timeout after {ESC}
|
||||
return nil
|
||||
else
|
||||
inesc_up = false
|
||||
end
|
||||
end
|
||||
return s, a, math.floor(asciitr[ascii] or ascii), keymap[ascii] or key, user
|
||||
|
Loading…
Reference in New Issue
Block a user