Fixed issue with values not being properly indented.-
This commit is contained in:
parent
a20f6bddb7
commit
b2b295cf8a
13
pretty.lua
13
pretty.lua
|
@ -237,6 +237,14 @@ local function get_full_function_str (str, start_line, end_line)
|
|||
return matched_function
|
||||
end
|
||||
|
||||
local function width_of_strings_in_l (l, start_i, end_i)
|
||||
local width = 0
|
||||
for i = start_i or 1, (end_i or #l) do
|
||||
width = width + #l[i]
|
||||
end
|
||||
return width
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Identifyer stuff
|
||||
|
@ -333,10 +341,11 @@ local function format_key_and_value_string_map (l, key, value, options, depth)
|
|||
end
|
||||
|
||||
local function format_key_and_value_arbitr_map (l, key, value, options, depth)
|
||||
local index_before_key = #l+1
|
||||
l[#l+1] = '['
|
||||
format_value(key, options, 'max', l)
|
||||
l[#l+1] = ']'
|
||||
l[#l+1] = #l[#l-1] + 2
|
||||
l[#l+1] = width_of_strings_in_l(l, index_before_key)
|
||||
l[#l+1] = ' = '
|
||||
format_value(value, options, depth, l)
|
||||
end
|
||||
|
@ -606,7 +615,7 @@ function format_value (value, options, depth, l)
|
|||
if format_func then
|
||||
format_func(value, options, depth, l)
|
||||
else
|
||||
error(ERROR_UNKNOWN_TYPE:format(type(value), tostring(value)))
|
||||
error(ERROR_UNKNOWN_TYPE:format(type(value), tostring(value)), 2)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user