+2

Change newline_at_eof installation preference to true

MarkDBlackwell fa 11 anys 0

It is a general, widely known practical observation that (at least some) people will leave (at least some of) their software preferences unchanged after installation.

Upon installation, the preference whether newlines are ensured at EOF on save is false.

This installation default is wreaking a small degree of havoc with programmers using versioning systems including git.

The reasonable and usual practice of software in Unix and elsewhere is to expect, and to maintain, that all lines end with a newline. This includes the final line. For more information, here are two links:

http://stackoverflow.com/questions/729692/why-should-files-end-with-a-newline

http://slashdot.org/comments.pl?sid=165492&cid=13808398

To be more precise, after installation, in Default/Preferences.sublime-settings these statements occur:

  // Set to true to ensure the last line of the file ends in a newline
  // character when saving
  "ensure_newline_at_eof_on_save": false,

This should be changed instead so after installation automatically the statements are:

  // Set to false to ensure the last line of the file does not end in a newline
  // character when saving
  "ensure_newline_at_eof_on_save": true,

Further, the editor must not display a new empty line after saving as it does now when this preference is set to true. This even though there is a final newline.

The editor may be treating newlines erroneously as line separators and not correctly as line terminators. This possibility is described in the links above.