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