aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtelem.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/telem.lua b/telem.lua
index bb68f7c..b73c275 100755
--- a/telem.lua
+++ b/telem.lua
@@ -279,11 +279,13 @@ function do_type()
-- Show prompt and read one char
io.write("[f]irst, [n]ext, [p]rev, [l]last, [r]eply, [d]one > ")
c = getchar()
- io.write("\n")
+ if c ~= "\n" then io.write("\n") end
-- Dispatch to sub-command
- if type_dispatch[c] == nil then
+ if c == "\n" then
+ -- pass
+ elseif type_dispatch[c] == nil then
print("Invalid command!")
- else
+ elseif c ~= "\n" then
type_dispatch[c]()
end
until c == "d"
@@ -357,11 +359,13 @@ repeat
-- Show prompt and read 1 char from keyboard
io.write("["..current_board.."] COMMAND :> ")
c = getchar()
- io.write("\n")
+ if c ~= "\n" then io.write("\n") end
-- Use char as index into dispatch table
- if dispatch[c] == nil then
+ if c == "\n" then
+ -- pass
+ elseif dispatch[c] == nil then
print("Unrecognised command, hit `h` for help.")
- else
+ else
dispatch[c]()
end
until c == "q"