diff options
author | Hans Bolinder <[email protected]> | 2015-11-26 15:58:30 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2015-11-27 09:15:55 +0100 |
commit | 49014e56350dc942fb950da98075cc781ea3b63a (patch) | |
tree | c74e4dc0d06b1e9c56aa415993518beffc814b44 /lib/stdlib | |
parent | 4e91911aec363d21ea2d6ff7d5f8e1888b0aa8f9 (diff) | |
download | otp-49014e56350dc942fb950da98075cc781ea3b63a.tar.gz otp-49014e56350dc942fb950da98075cc781ea3b63a.tar.bz2 otp-49014e56350dc942fb950da98075cc781ea3b63a.zip |
stdlib: Fix the shell command rp and pretty-printing
The shell command 'rp' prints strings as lists of integers
when pretty printing of lists is 'false'.
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/src/shell.erl | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl index f215a66812..ce1d9eb0ff 100644 --- a/lib/stdlib/src/shell.erl +++ b/lib/stdlib/src/shell.erl @@ -999,12 +999,7 @@ local_func(rl, [A], Bs0, _Shell, RT, Lf, Ef) -> {value,list_records(record_defs(RT, listify(Recs))),Bs}; local_func(rp, [A], Bs0, _Shell, RT, Lf, Ef) -> {[V],Bs} = expr_list([A], Bs0, Lf, Ef), - Cs = io_lib_pretty:print(V, ([{column, 1}, - {line_length, columns()}, - {depth, -1}, - {max_chars, ?CHAR_MAX}, - {record_print_fun, record_print_fun(RT)}] - ++ enc())), + Cs = pp(V, _Column=1, _Depth=-1, RT), io:requests([{put_chars, unicode, Cs}, nl]), {value,ok,Bs}; local_func(rr, [A], Bs0, _Shell, RT, Lf, Ef) -> @@ -1397,9 +1392,9 @@ get_history_and_results() -> {History, erlang:min(Results, History)}. pp(V, I, RT) -> - pp(V, I, RT, enc()). + pp(V, I, _Depth=?LINEMAX, RT). -pp(V, I, RT, Enc) -> +pp(V, I, D, RT) -> Strings = case application:get_env(stdlib, shell_strings) of {ok, false} -> @@ -1408,10 +1403,10 @@ pp(V, I, RT, Enc) -> true end, io_lib_pretty:print(V, ([{column, I}, {line_length, columns()}, - {depth, ?LINEMAX}, {max_chars, ?CHAR_MAX}, + {depth, D}, {max_chars, ?CHAR_MAX}, {strings, Strings}, {record_print_fun, record_print_fun(RT)}] - ++ Enc)). + ++ enc())). columns() -> case io:columns() of |