mwm nearly there

This commit is contained in:
kepler155c@gmail.com
2019-02-07 10:11:00 -05:00
parent 3f2f8afaad
commit e537922e46

View File

@@ -4,6 +4,7 @@ if not _G.requireInjector then
end end
local Terminal = require('terminal') local Terminal = require('terminal')
local trace = require('trace')
local Util = require('util') local Util = require('util')
local colors = _G.colors local colors = _G.colors
@@ -55,13 +56,23 @@ local function nextUID()
return UID return UID
end end
local function xprun(env, path, ...)
setmetatable(env, { __index = _G })
local fn, m = loadfile(path, env)
if fn then
return trace(fn, ...)
end
return fn, m
end
local function write(win, x, y, text) local function write(win, x, y, text)
win.setCursorPos(x, y) win.setCursorPos(x, y)
win.write(text) win.write(text)
end end
local function redraw() local function redraw()
monitor.clear() --monitor.clear()
monitor.canvas:dirty()
for k,process in ipairs(processes) do for k,process in ipairs(processes) do
process.container.canvas:dirty() process.container.canvas:dirty()
process:focus(k == #processes) process:focus(k == #processes)
@@ -118,7 +129,7 @@ function Process:new(args)
if args.fn then if args.fn then
result, err = Util.runFunction(args.env, args.fn, table.unpack(self.args)) result, err = Util.runFunction(args.env, args.fn, table.unpack(self.args))
elseif args.path then elseif args.path then
result, err = Util.run(args.env, args.path, table.unpack(self.args)) result, err = xprun(args.env, args.path, table.unpack(self.args))
end end
if not result and err and err ~= 'Terminated' then if not result and err and err ~= 'Terminated' then
@@ -369,7 +380,7 @@ function multishell.removeProcess(process)
process.container.canvas:removeLayer() process.container.canvas:removeLayer()
multishell.saveSession(sessionFile) multishell.saveSession(sessionFile)
redraw() --redraw()
end end
function multishell.saveSession(filename) function multishell.saveSession(filename)
@@ -462,8 +473,6 @@ function multishell.start()
end end
end end
monitor.canvas:dirty()
monitor.canvas:render(parentMon) monitor.canvas:render(parentMon)
local didRedraw = true local didRedraw = true