c:ls() bug?

James Hague jamesh@REDACTED
Mon Oct 21 19:00:32 CEST 2002

To see this, go into a directory with, say, 10 or more files and make sure
the longest filename is exactly 15 characters.  After typing ls() from the
shell, the list of filenames is printed double-spaced.  That is, there is an
extra newline between each row.

What appears to be happening is that when a line of output is reaches 80
characters, there's an implied newline as the cursor wraps to the next line.
The same thing happens with both erl.exe and werl.exe running under Windows
2000.  It's not like werl.exe can only display 80 columns, so it's a bit

The simple fix is to change this line in c.erl:

ls_print(X, Width, Len) when Width + Len > 80 ->

to this:

ls_print(X, Width, Len) when Width + Len >= 80 ->

which cuts the number of columns from 4 to three in this case.  Is this a
Windows specific problem or does it also occur elsewhere?

More information about the erlang-questions mailing list