Added max width for callstack, and properly exit when hijacking error().
This commit is contained in:
parent
adfab5b79d
commit
a26064213c
6
ldt.lua
6
ldt.lua
@ -461,7 +461,7 @@ ldb = {
|
|||||||
max_filename = math.max(max_filename, #stack_locations[i])
|
max_filename = math.max(max_filename, #stack_locations[i])
|
||||||
end
|
end
|
||||||
local stack_h = math.max(#stack_names + 2, math.floor(2 / 3 * SCREEN_H))
|
local stack_h = math.max(#stack_names + 2, math.floor(2 / 3 * SCREEN_H))
|
||||||
local stack_w = max_fn_name + 3 + max_filename
|
local stack_w = math.min(max_fn_name + 3 + max_filename, math.floor(1 / 3 * SCREEN_W))
|
||||||
pads.stack = Pad("(C)allstack", pads.err.height, SCREEN_W - stack_w, stack_h, stack_w, stack_names, (function(self, i)
|
pads.stack = Pad("(C)allstack", pads.err.height, SCREEN_W - stack_w, stack_h, stack_w, stack_names, (function(self, i)
|
||||||
return (i == self.selected) and color("black on green") or color("green bold")
|
return (i == self.selected) and color("black on green") or color("green bold")
|
||||||
end), stack_locations, (function(self, i)
|
end), stack_locations, (function(self, i)
|
||||||
@ -735,7 +735,9 @@ ldb = {
|
|||||||
end,
|
end,
|
||||||
hijack_error = function()
|
hijack_error = function()
|
||||||
error = function(err_msg)
|
error = function(err_msg)
|
||||||
return xpcall(ldb.run_debugger, err_hand, err_msg)
|
xpcall(ldb.run_debugger, err_hand, err_msg)
|
||||||
|
print(debug.traceback(err_msg, 2))
|
||||||
|
return os.exit(2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
7
ldt.moon
7
ldt.moon
@ -314,7 +314,7 @@ ldb = {
|
|||||||
max_filename = math.max(max_filename, #stack_locations[i])
|
max_filename = math.max(max_filename, #stack_locations[i])
|
||||||
|
|
||||||
stack_h = math.max(#stack_names+2, math.floor(2/3*SCREEN_H))
|
stack_h = math.max(#stack_names+2, math.floor(2/3*SCREEN_H))
|
||||||
stack_w = max_fn_name + 3 + max_filename
|
stack_w = math.min(max_fn_name + 3 + max_filename, math.floor(1/3*SCREEN_W))
|
||||||
pads.stack = Pad "(C)allstack",pads.err.height,SCREEN_W-stack_w,stack_h,stack_w,
|
pads.stack = Pad "(C)allstack",pads.err.height,SCREEN_W-stack_w,stack_h,stack_w,
|
||||||
stack_names, ((i)=> (i == @selected) and color("black on green") or color("green bold")),
|
stack_names, ((i)=> (i == @selected) and color("black on green") or color("green bold")),
|
||||||
stack_locations, ((i)=> (i == @selected) and color("black on cyan") or color("cyan bold"))
|
stack_locations, ((i)=> (i == @selected) and color("black on cyan") or color("cyan bold"))
|
||||||
@ -540,6 +540,9 @@ ldb = {
|
|||||||
hijack_error: ->
|
hijack_error: ->
|
||||||
export error
|
export error
|
||||||
error = (err_msg)->
|
error = (err_msg)->
|
||||||
return xpcall(ldb.run_debugger, err_hand, err_msg)
|
xpcall(ldb.run_debugger, err_hand, err_msg)
|
||||||
|
print(debug.traceback(err_msg, 2))
|
||||||
|
os.exit(2)
|
||||||
|
|
||||||
}
|
}
|
||||||
return ldb
|
return ldb
|
||||||
|
Loading…
Reference in New Issue
Block a user