Fixes for problems encountered in real-world testing.

This commit is contained in:
Bruce Hill 2018-04-06 18:18:36 -07:00
parent bb38223ec0
commit 00bb657027
2 changed files with 8 additions and 4 deletions

View File

@ -932,6 +932,9 @@ end
ldb = {
run_debugger = function(err_msg)
err_msg = err_msg or ''
if type(err_msg) ~= 'string' then
err_msg = tostring(err_msg)
end
local stdscr = C.initscr()
local SCREEN_H, SCREEN_W = stdscr:getmaxyx()
C.cbreak()
@ -954,7 +957,7 @@ ldb = {
stdscr:wbkgd(Color("yellow on red bold"))
stdscr:clear()
stdscr:refresh()
local lines = wrap_text("ERROR!\n \n " .. err_msg .. "\n \npress any key...", math.floor(SCREEN_W / 2))
local lines = wrap_text("ERROR!\n \n " .. err_msg .. "\n \npress any key...", math.floor(SCREEN_W - 2))
local max_line = 0
for _index_0 = 1, #lines do
local line = lines[_index_0]
@ -1134,7 +1137,7 @@ ldb = {
end
local value_x = pads.vars.x + pads.vars.width
local value_w = SCREEN_W - (value_x)
local value = values[var_index]
local value = stack_env[var_names[var_index]]
local type_str = type(value)
pads.values = DataViewer(value, "(D)ata [" .. tostring(type_str) .. "]", var_y, value_x, pads.vars.height, value_w)
collectgarbage()

View File

@ -599,6 +599,7 @@ err_hand = (err)->
ldb = {
run_debugger: (err_msg)->
err_msg or= ''
if type(err_msg) != 'string' then err_msg = tostring(err_msg)
stdscr = C.initscr!
SCREEN_H, SCREEN_W = stdscr\getmaxyx!
C.cbreak!
@ -621,7 +622,7 @@ ldb = {
stdscr\wbkgd(Color"yellow on red bold")
stdscr\clear!
stdscr\refresh!
lines = wrap_text("ERROR!\n \n "..err_msg.."\n \npress any key...", math.floor(SCREEN_W/2))
lines = wrap_text("ERROR!\n \n "..err_msg.."\n \npress any key...", math.floor(SCREEN_W-2))
max_line = 0
for line in *lines do max_line = math.max(max_line, #line)
for i, line in ipairs(lines)
@ -752,7 +753,7 @@ ldb = {
if var_index == nil then return
value_x = pads.vars.x+pads.vars.width
value_w = SCREEN_W-(value_x)
value = values[var_index]
value = stack_env[var_names[var_index]]--values[var_index]
type_str = type(value)
-- Show single value:
pads.values = DataViewer value, "(D)ata [#{type_str}]", var_y,value_x,pads.vars.height,value_w