Sublime Forum

Show/hide \n before EOF

#1

Hello there.

Is possible to add setting ‘show/hide new line before EOF’?

https://p.twimg.com/Aj_61EiCAAEbfQL.png

https://p.twimg.com/Aj_7Gf0CMAAwUml.png

0 Likes

#2

Why not just delete the last empty line?

But seriously, if the file has an empty last line but the editor doesn’t show it, then you would have a incorrect view of the file contents (which would be considered a bug in the editor). I’m having trouble understanding why you would want this “feature”…does the extra number in the gutter annoy you that much?

If you really want to have this behaviour, then you might consider writing a plugin that removes any extra newlines at the end of the file. Maybe this could be triggered when you save the file?

0 Likes

#3

You can’t delete the last empty line from the file because there isn’t one. Newline characters are line terminators, not line separators, so there isn’t actually a line after the final newline character.

Currently Sublime erroneously shows an extra spurious line after the final line of the file when ensure_newline_at_eof_on_save is on (as it always should be). The correct behaviour would be to recognise that the final newline character terminates the last line of the file and does not start another new line.

0 Likes