1
0

Fixed issue with values not being properly indented.-

This commit is contained in:
Jon Michael Aanes 2017-01-05 13:44:47 +01:00
parent a20f6bddb7
commit b2b295cf8a

View File

@ -237,6 +237,14 @@ local function get_full_function_str (str, start_line, end_line)
return matched_function return matched_function
end 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 -- Identifyer stuff
@ -333,10 +341,11 @@ local function format_key_and_value_string_map (l, key, value, options, depth)
end end
local function format_key_and_value_arbitr_map (l, key, value, options, depth) local function format_key_and_value_arbitr_map (l, key, value, options, depth)
local index_before_key = #l+1
l[#l+1] = '[' l[#l+1] = '['
format_value(key, options, 'max', l) format_value(key, options, 'max', l)
l[#l+1] = ']' 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] = ' = ' l[#l+1] = ' = '
format_value(value, options, depth, l) format_value(value, options, depth, l)
end end
@ -606,7 +615,7 @@ function format_value (value, options, depth, l)
if format_func then if format_func then
format_func(value, options, depth, l) format_func(value, options, depth, l)
else else
error(ERROR_UNKNOWN_TYPE:format(type(value), tostring(value))) error(ERROR_UNKNOWN_TYPE:format(type(value), tostring(value)), 2)
end end
end end