aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/io_lib_pretty.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2018-04-20 12:19:12 +0200
committerHans Bolinder <[email protected]>2018-04-25 16:25:22 +0200
commit872548b0c798e1e1fe9350d04c9460f3a6db5d41 (patch)
tree8eb26eba47a1cad7b37e7c75ea43c2f71bfc7bbd /lib/stdlib/src/io_lib_pretty.erl
parent29a347ffd408c68861a914db4efc75d8ea20a762 (diff)
downloadotp-872548b0c798e1e1fe9350d04c9460f3a6db5d41.tar.gz
otp-872548b0c798e1e1fe9350d04c9460f3a6db5d41.tar.bz2
otp-872548b0c798e1e1fe9350d04c9460f3a6db5d41.zip
stdlib: Modify the printing of map associations with wWpP
Use the same depth for all (printed) elements of a map. Since the order of keys can vary when printing a map--maps:iterator/1 and maps:next/1 are used--it is more consistent to print all associations with the same depth. If the associations printed are limited by the depth, the selection of associations is arbitrary, as before.
Diffstat (limited to 'lib/stdlib/src/io_lib_pretty.erl')
-rw-r--r--lib/stdlib/src/io_lib_pretty.erl16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/stdlib/src/io_lib_pretty.erl b/lib/stdlib/src/io_lib_pretty.erl
index 2204231943..3d5a979b3e 100644
--- a/lib/stdlib/src/io_lib_pretty.erl
+++ b/lib/stdlib/src/io_lib_pretty.erl
@@ -596,21 +596,23 @@ print_length_map(Map, 1, _T, RF, Enc, Str) ->
{"#{...}", 6, 3, More};
print_length_map(Map, D, T, RF, Enc, Str) when is_map(Map) ->
Next = maps:next(maps:iterator(Map)),
- PairsS = print_length_map_pairs(Next, D, tsub(T, 3), RF, Enc, Str),
+ PairsS = print_length_map_pairs(Next, D, D - 1, tsub(T, 3), RF, Enc, Str),
{Len, Dots} = list_length(PairsS, 3, 0),
{{map, PairsS}, Len, Dots, no_more}.
-print_length_map_pairs(none, _D, _T, _RF, _Enc, _Str) ->
+print_length_map_pairs(none, _D, _D0, _T, _RF, _Enc, _Str) ->
[];
-print_length_map_pairs(Term, D, T, RF, Enc, Str) when D =:= 1; T =:= 0->
- More = fun(T1, Dd) -> ?FUNCTION_NAME(Term, D+Dd, T1, RF, Enc, Str) end,
+print_length_map_pairs(Term, D, D0, T, RF, Enc, Str) when D =:= 1; T =:= 0->
+ More = fun(T1, Dd) ->
+ ?FUNCTION_NAME(Term, D+Dd, D0, T1, RF, Enc, Str)
+ end,
{dots, 3, 3, More};
-print_length_map_pairs({K, V, Iter}, D, T, RF, Enc, Str) ->
- Pair1 = print_length_map_pair(K, V, D - 1, tsub(T, 1), RF, Enc, Str),
+print_length_map_pairs({K, V, Iter}, D, D0, T, RF, Enc, Str) ->
+ Pair1 = print_length_map_pair(K, V, D0, tsub(T, 1), RF, Enc, Str),
{_, Len1, _, _} = Pair1,
Next = maps:next(Iter),
[Pair1 |
- print_length_map_pairs(Next, D - 1, tsub(T, Len1+1), RF, Enc, Str)].
+ print_length_map_pairs(Next, D - 1, D0, tsub(T, Len1+1), RF, Enc, Str)].
print_length_map_pair(K, V, D, T, RF, Enc, Str) ->
{_, KL, KD, _} = P1 = print_length(K, D, T, RF, Enc, Str),