Trim trailing spaces before adding new line at end of file

Xaapyks 12 years ago updated 11 years ago 2

 Currently if you have ensure_newline_at_eof_on_save  AND trim_trailing_white_space_on_save enabled the following can happen :

if the last line of your file is a space, ST2 will first honor ensure_newline_at_eof_on_save and add a new empty line at the end of the file. Then it will honor trim_trailing_white_space_on_save and trim the (now) last-but-one line.

Result : you now have 2 empty lines at the end of your file

Expected result : 1 empty line at end of file.

Way to fix this : Honoring trim_trailing_white_space_on_save BEFORE ensure_newline_at_eof_on_save or just don't add a new line if last one is space only and trim_trailing_white_space_on_save is enabled.

It is a minor bug but it annoys me a lot.

This also annoys me, +1 :). Have you checked this is still the default behavior in ST3 ?

Yes, it is still the behavior in latest ST3 dev version