Closed cassanof closed 1 year ago
Thanks for the report!
I can reproduce the issue when running fmt
on the file in Mac OS.
Do you know what will happen when you run fmt
on the file in Windows? Does it produce a malformed output too? I don't have Windows installed, so I can't test it out.
My fix above makes fmt
work correctly on the mentioned file when run on Mac OS. But since I run on Mac OS, the formatted file doesn't retain CRLF. I think if fmt
is run on Windows, CRLF will be preserved however (but correct me if I'm wrong -- again, I don't have Windows, so I can't test it).
It remains a question whether this behavior is desirable -- perhaps there should be an option to preserve CRLF? In any case, I think the original issue is now fixed. It no longer produces a malformed program.
Hello, Windows' way of inserting line breaks ("\n\r") creates a problem in the formatter. Here is a link to a file formatted using this style: https://gist.github.com/d2db686a7ad030ecb7a0524bd890ed98
the input file contains:
and
raco fmt
outputswhich is broken code.