mirror of
https://github.com/kepler155c/opus
synced 2025-04-13 14:23:15 +00:00
check for recursive requires + Lua update
This commit is contained in:
parent
8c1abb21ca
commit
195dbd365a
@ -89,14 +89,21 @@ return function(env)
|
||||
end
|
||||
|
||||
local function loadedSearcher(modname)
|
||||
if env.package.loaded[modname] then
|
||||
if env.package.loaded[modname] then
|
||||
return function()
|
||||
return env.package.loaded[modname]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local sentinel = { }
|
||||
|
||||
local function pathSearcher(modname)
|
||||
if env.package.loaded[modname] == sentinel then
|
||||
error("loop or previous error loading module '" .. modname .. "'", 0)
|
||||
end
|
||||
env.package.loaded[modname] = sentinel
|
||||
|
||||
local fname = modname:gsub('%.', '/')
|
||||
|
||||
for pattern in string.gmatch(env.package.path, "[^;]+") do
|
||||
|
@ -45,28 +45,33 @@ local page = UI.Page {
|
||||
[ 'control-space' ] = 'autocomplete',
|
||||
},
|
||||
},
|
||||
grid = UI.ScrollingGrid {
|
||||
y = 3, ey = -2,
|
||||
columns = {
|
||||
{ heading = 'Key', key = 'name' },
|
||||
{ heading = 'Value', key = 'value' },
|
||||
tabs = UI.Tabs {
|
||||
y = 3,
|
||||
[1] = UI.Tab {
|
||||
tabTitle = 'Formatted',
|
||||
grid = UI.ScrollingGrid {
|
||||
columns = {
|
||||
{ heading = 'Key', key = 'name' },
|
||||
{ heading = 'Value', key = 'value' },
|
||||
},
|
||||
sortColumn = 'name',
|
||||
autospace = true,
|
||||
},
|
||||
},
|
||||
[2] = UI.Tab {
|
||||
tabTitle = 'Output',
|
||||
output = UI.Embedded {
|
||||
visible = true,
|
||||
maxScroll = 1000,
|
||||
backgroundColor = colors.black,
|
||||
},
|
||||
},
|
||||
sortColumn = 'name',
|
||||
autospace = true,
|
||||
},
|
||||
titleBar = UI.TitleBar {
|
||||
title = 'Output',
|
||||
y = -1,
|
||||
event = 'show_output',
|
||||
closeInd = '^'
|
||||
},
|
||||
output = UI.Embedded {
|
||||
y = -6,
|
||||
visible = true,
|
||||
backgroundColor = colors.gray,
|
||||
},
|
||||
}
|
||||
|
||||
page.grid = page.tabs[1].grid
|
||||
page.output = page.tabs[2].output
|
||||
|
||||
function page:setPrompt(value, focus)
|
||||
self.prompt:setValue(value)
|
||||
self.prompt.scroll = 0
|
||||
@ -84,9 +89,8 @@ function page:setPrompt(value, focus)
|
||||
end
|
||||
|
||||
function page:enable()
|
||||
self:setFocus(self.prompt)
|
||||
UI.Page.enable(self)
|
||||
self.output:disable()
|
||||
self:setFocus(self.prompt)
|
||||
end
|
||||
|
||||
local function autocomplete(env, oLine, x)
|
||||
@ -145,18 +149,11 @@ function page:eventHandler(event)
|
||||
|
||||
self:draw()
|
||||
|
||||
elseif event.type == 'tab_select' then
|
||||
self:setFocus(self.prompt)
|
||||
|
||||
elseif event.type == 'show_output' then
|
||||
self.output:enable()
|
||||
|
||||
self.titleBar.oy = -7
|
||||
self.titleBar.event = 'hide_output'
|
||||
self.titleBar.closeInd = 'v'
|
||||
self.titleBar:resize()
|
||||
|
||||
self.grid.ey = -8
|
||||
self.grid:resize()
|
||||
|
||||
self:draw()
|
||||
self.tabs:selectTab(self.tabs[2])
|
||||
|
||||
elseif event.type == 'autocomplete' then
|
||||
local sz = #self.prompt.value
|
||||
@ -186,8 +183,6 @@ function page:eventHandler(event)
|
||||
local s = tostring(self.prompt.value)
|
||||
|
||||
if #s > 0 then
|
||||
history:add(s)
|
||||
history:back()
|
||||
self:executeStatement(s)
|
||||
else
|
||||
local t = { }
|
||||
@ -331,9 +326,18 @@ end
|
||||
function page:executeStatement(statement)
|
||||
command = statement
|
||||
|
||||
history:add(statement)
|
||||
history:back()
|
||||
|
||||
local s, m
|
||||
local oterm = term.redirect(self.output.win)
|
||||
self.output.win.scrollBottom()
|
||||
local bg, fg = term.getBackgroundColor(), term.getTextColor()
|
||||
term.setBackgroundColor(colors.black)
|
||||
term.setTextColor(colors.yellow)
|
||||
print('> ' .. tostring(statement))
|
||||
term.setBackgroundColor(bg)
|
||||
term.setTextColor(fg)
|
||||
pcall(function()
|
||||
s, m = self:rawExecute(command)
|
||||
end)
|
||||
|
@ -13,7 +13,7 @@ local tab = UI.Tab {
|
||||
accelerators = {
|
||||
enter = 'update_path',
|
||||
},
|
||||
help = 'add a new path',
|
||||
help = 'add a new path (reboot required)',
|
||||
},
|
||||
grid = UI.Grid {
|
||||
y = 4, ey = -3,
|
||||
|
Loading…
x
Reference in New Issue
Block a user