summaryrefslogtreecommitdiffstatshomepage
path: root/plugins
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2016-11-05 19:33:17 -0500
committer cracyc <cracyc@users.noreply.github.com>2016-11-06 13:41:46 -0600
commita6aaa59d19c5183ba16da11ab963646ffbb66aa3 (patch)
tree571edb12468d4b7f2cda7e38a4a3b043ad88a722 /plugins
parent68ff36882cc9555dde14bba5f50af8d2d552fbd5 (diff)
lua-linenoise: add preload (nw)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/console/init.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/console/init.lua b/plugins/console/init.lua
index 3e5487c7b60..151af204400 100644
--- a/plugins/console/init.lua
+++ b/plugins/console/init.lua
@@ -13,6 +13,7 @@ function console.startplugin()
local conth = emu.thread()
local started = false
local ln = require("linenoise")
+ local preload = false
print(" _/ _/ _/_/ _/ _/ _/_/_/_/");
print(" _/_/ _/_/ _/ _/ _/_/ _/_/ _/ ");
print(" _/ _/ _/ _/_/_/_/ _/ _/ _/ _/_/_/ ");
@@ -76,14 +77,25 @@ function console.startplugin()
ln.historyadd(cmd)
local func, err = load(cmd)
if not func then
- print("error: ", err)
+ if err:match("<eof>") then
+ print("incomplete command")
+ ln.preload(cmd)
+ preload = true
+ else
+ print("error: ", err)
+ preload = false
+ end
else
+ preload = false
local status
status, err = pcall(func)
if not status then
print("error: ", err)
end
end
+ if not preload then
+ ln.historyadd(cmd)
+ end
end
conth:start(scr)
started = true