debugger cleanup + ls now supports date

This commit is contained in:
kepler155c@gmail.com
2020-05-27 14:49:51 -06:00
parent 70001196cb
commit 8fef5d3580
5 changed files with 80 additions and 9 deletions

View File

@@ -9,7 +9,6 @@ local function breakpointHook(info)
if dbg.breakpoints then
for _,v in pairs(dbg.breakpoints) do
if v.line == info.currentline and v.file == info.short_src then
print(v.line, not v.disabled)
return not v.disabled
end
end
@@ -96,6 +95,9 @@ local function local_bindings(offset, stack_inspect_offset)
if k ~= '(*temporary)' then
v.name = k
v.value = tostring(v.raw)
--if type(v.raw) == 'table' and not next(v.raw) then
-- v.value = 'table: (empty)'
--end
table.insert(t, v)
end
end
@@ -180,11 +182,11 @@ local function hook()
end
end
function dbg.call(f, ...)
function dbg.call(fn, ...)
local args = { ... }
return xpcall(
function()
f(table.unpack(args))
fn(table.unpack(args))
end,
function(err)
hookEval = stepHook()
@@ -196,9 +198,9 @@ end
_ENV.coroutine = setmetatable({
create = function(f)
create = function(fn)
local co = _G.coroutine.create(function(...)
local r = { dbg.call(f, ...) }
local r = { dbg.call(fn, ...) }
if not r[1] then
error(r[2], -1)

View File

@@ -291,7 +291,7 @@ local page = UI.Page {
end,
},
statusBar = UI.StatusBar {
ex = -7, y = -1,
ex = -12, y = -1,
backgroundColor = 'black',
textColor = 'orange',
},
@@ -301,6 +301,12 @@ local page = UI.Page {
event = 'open',
text = 'Open',
},
UI.FlatButton {
y = -1, x = -10,
textColor = 'orange',
event = 'edit_file',
text = 'Edit',
},
quick_open = UI.QuickSelect {
y = '50%',
@@ -323,6 +329,18 @@ local page = UI.Page {
end,
},
textDisplay = UI.SlideOut {
ey = '50%',
textArea = UI.TextArea {
ey = -2,
},
UI.Button {
x = '50%', y = -1,
text = 'Ok',
event = 'slide_hide',
}
},
openFile = function(self, file, line)
if file ~= currentFile then
local src = loadSource(file)
@@ -342,6 +360,17 @@ local page = UI.Page {
end
self:draw()
end,
editFile = function(_, file)
if fs.exists(file) then
multishell.openTab(_ENV, {
path = 'sys/apps/shell.lua',
args = { 'edit ' .. file },
focused = true,
})
end
end,
eventHandler = function(self, event)
if event.type == 'cmd' then
self.statusBar:setStatus('Running...')
@@ -356,6 +385,9 @@ local page = UI.Page {
elseif event.type == 'open' then
self.quick_open:show()
elseif event.type == 'edit_file' then
self:editFile(currentFile)
elseif event.type == 'open_file' then
self:openFile(event.file, event.line)
@@ -409,6 +441,9 @@ local page = UI.Page {
insert(event.element.orig)
event.element:setValues(t)
event.element:draw()
else
self.textDisplay.textArea:setValue(event.selected.value)
self.textDisplay:show()
end
end
return UI.Page.eventHandler(self, event)