Closed garretwilson closed 7 years ago
OK, this is getting more complicated and worse. To understand the situation, let me remind you of the history:
atom-beautify
to attempt to reformat the file: to normalize the line endings, and get rid of the extra newlines. This only halfway works; many of the erroneous newlines remain because of a js-beautify
bug. I have also paid my money on a bounty to get this fixed, but no one seems interested.The file in question is of mixed line endings because of this. Normally Atom will show the LF and CRLF line endings as distinct (and at least js-beautify
will normalize them). But in the file at issue here, Atom 1.19.0 is not showing the line endings as different, and the line ending indicator at the bottom shows CRLF even though the line endings are mixed.
If I use another editor such as EmEditor to change all the line endings to CRLF or LF (it doesn't matter which, as long as they are all the same), this bug no longer appears!! That is, atom-beautify
formats the file with no problem.
So are we now dealing with a new Atom line-ending bug, on top of the BlueGriffon and js-beautify
bugs?? (When will it end?!!) The failure of Atom to distinguish the line endings could be an indication of a problem. Or is the display in the editor a red herring, and is atom-beautify
(or js-beautify
) skipping line endings incorrectly, assuming they are all the same?
I'm attaching the exact file that causes the problem. Now that we know it potentially has something to do with line endings, copying and pasting from the inline example above won't help anything.
This time it was a bug deep inside Atom: https://github.com/atom/atom/issues/15225 . Apparently they rewrote the low-level buffer handling and didn't pay attention to the line endings, or something to that affect. They claim to have a fix on the way. I'm going to close this atom-beautify issue.
I'm using Atom 1.19.0 ia32 with atom-beautify 0.30.4 on Windows 10 Pro 64-bit. I'm using the following
.jsbeautifyrc
:I have the following content. (Copyright © 2016–2017 GlobalMentor, Inc. Excerpted for bug investigation.)
This is what atom-beautify produces after formatting:
Notice the lines after
<figcaption>Examples of local time classes.</figcaption>
. Specifically, after//someone's date of birth: May 30, 1970
, some content has been dropped. In fact depending on the actual surrounding content (e.g. in the original document), sometimes content seems to be moved around arbitrarily!This bug has already been reported at https://github.com/beautify-web/js-beautify/issues/1225 , but note that this is not reproducible on the js-beautify site, so @bitwiseman indicated it probably was not a js-beautify problem.