util.debug: Move boundary markers to top of relevant sections of the stack trace (easier to follow)
authorMatthew Wild <mwild1@gmail.com>
Thu, 22 Mar 2012 16:51:39 +0000
changeset 4525 e00b4ec5fca4
parent 4524 816c319a09d8
child 4527 d00f31470fcf
util.debug: Move boundary markers to top of relevant sections of the stack trace (easier to follow)
util/debug.lua
--- a/util/debug.lua	Thu Mar 22 16:39:28 2012 +0000
+++ b/util/debug.lua	Thu Mar 22 16:51:39 2012 +0000
@@ -113,7 +113,7 @@
 
 local function build_source_boundary_marker(last_source_desc)
 	local padding = string.rep("-", math.floor(((optimal_line_length - 6) - #last_source_desc)/2));
-	return getstring(styles.boundary_padding, "^"..padding).." "..getstring(styles.filename, last_source_desc).." "..getstring(styles.boundary_padding, padding..(#last_source_desc%2==0 and "-^" or "^ "));
+	return getstring(styles.boundary_padding, "v"..padding).." "..getstring(styles.filename, last_source_desc).." "..getstring(styles.boundary_padding, padding..(#last_source_desc%2==0 and "-v" or "v "));
 end
 
 function debug._traceback(thread, message, level)
@@ -158,10 +158,8 @@
 			line = "[Lua] "..getstring(styles.location, info.short_src.." line "..info.currentline).." in "..func_type..getstring(styles.funcname, name).." (defined on line "..info.linedefined..")";
 		end
 		if source_desc ~= last_source_desc then -- Venturing into a new source, add marker for previous
-			if last_source_desc then
-				table.insert(lines, "\t "..build_source_boundary_marker(last_source_desc));
-			end
 			last_source_desc = source_desc;
+			table.insert(lines, "\t "..build_source_boundary_marker(last_source_desc));
 		end
 		nlevel = nlevel-1;
 		table.insert(lines, "\t"..(nlevel==0 and ">" or " ")..getstring(styles.level_num, "("..nlevel..") ")..line);
@@ -176,7 +174,7 @@
 		end
 	end
 
-	table.insert(lines, "\t "..build_source_boundary_marker(last_source_desc));
+--	table.insert(lines, "\t "..build_source_boundary_marker(last_source_desc));
 
 	return message.."stack traceback:\n"..table.concat(lines, "\n");
 end