From c489d4bc4f4c061121006f88ed7d4ac08de8d778 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Sat, 19 Jun 2021 15:13:26 +0100 Subject: [PATCH] Fix exiting paint typing "e" in the shell When exiting paint via the keyboard by typing "Ctrl" then "E" separately, we consume the "key" event within paint, leaving the shell to consume "read". To avoid this, we run a sleep(0) to gobble any other left-over events. Note, it's generally not enough to run a queueEvent/pullEvent here, as the char event may not have ended up on the queue yet. Alas, as this solution is pretty ugly. --- .../data/computercraft/lua/rom/programs/fun/advanced/paint.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/data/computercraft/lua/rom/programs/fun/advanced/paint.lua b/src/main/resources/data/computercraft/lua/rom/programs/fun/advanced/paint.lua index ad1f96b34..044b12116 100644 --- a/src/main/resources/data/computercraft/lua/rom/programs/fun/advanced/paint.lua +++ b/src/main/resources/data/computercraft/lua/rom/programs/fun/advanced/paint.lua @@ -290,6 +290,7 @@ local menu_choices = { return false end, Exit = function() + sleep(0) -- Super janky, but consumes stray "char" events from pressing Ctrl then E separately. return true end, }