I was writing a package to add highlighting of trailing white space (yes, I know there is an auto-remove trailing whitespace package — sometimes I want to see it and have the option), but I ran into a hurdle. First, the good news: Atom marks up trailing whitespace with a special class (
<span class="trailing-whitespace" />). The plugin was essentially two lines of CSS (!!!).
But there is a problem with soft-wrapped lines. The thing is, Atom hard-wraps them. They aren’t soft-wrapped — it realizes they need to wrap, so it creates a new line. These lines aren’t marked up in any way that indicates that they are part of a longer, soft-wrapped line. So pretend that this is a really long line:
This is a really long line.
And say it soft-wraps like this:
This is a_ really long line.
This is a? That’s representing marked-up trailing whitespace. Boo. There is no way to tell the difference between that line soft-wrapped, and the resulting two lines if they were originally written that way.
- Don’t mark trailing whitespace as trailing whitespace when it is on a non-last portion of a soft-wrapped line.
- Wrap soft-wrapped lines in some sort of “soft-wrapped-line-group” element.