[erlang-questions] fixed 80 columns in io:format
Attila Rajmund Nohl
attila.r.nohl@REDACTED
Tue Sep 7 15:55:15 CEST 2010
2010/6/2, Ulf Wiger <ulf.wiger@REDACTED>:
[...]
> However, if you want the shell to make use of a wider tty,
> the culprit is this:
>
> http://github.com/erlang/otp/blob/dev/lib/stdlib/src/shell.erl#L1424
>
> pp(V, I, RT) ->
> io_lib_pretty:print(V, I, columns(), ?LINEMAX, ?CHAR_MAX,
> record_print_fun(RT)).
>
> The ?CHAR_MAX macro expands to 60, which sets the actual
> limit for the column depth. If this were -1 instead, the
> pretty printer would make use of the full width of the window.
With ?CHAR_MAX (I'm not sure if it shows, but the result from the
lists:seq is printed in two lines, the io:format is printed in 3
lines):
1> L=lists:seq(1,60).
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,
23,24,25,26,27,28,29|...]
2> io:format("~p~n", [L]).
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,
29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,
54,55,56,57,58,59,60]
ok
With -1 (the result from the lists:seq is printed in one line, the
io:format is still printed in 3 lines):
1> L=lists:seq(1,60).
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29|...]
2> io:format("~p~n", [L]).
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,
29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,
54,55,56,57,58,59,60]
ok
My terminal is actually 182 characters wide xterm. Is there a way to
tell erlang to use all this width?
More information about the erlang-questions
mailing list