yi-editor / yi

The Haskell-Scriptable Editor
GNU General Public License v2.0
1.5k stars 199 forks source link

yi does not insert a newline on save #1104

Open chessai opened 5 years ago

chessai commented 5 years ago

this is a pretty common feature of text editors, it makes sure that a lot of common tools such as cat behave properly. I know i can configure this myself, but i feel like this should probably be the default.

Fuuzetsu commented 5 years ago

Is it a default on any editor? Pretty sure emacs doesn't do this unless you set it up.

chessai commented 5 years ago

On vim, yes afaiaa

On Tue, Dec 4, 2018, 1:17 AM Mateusz Kowalczyk <notifications@github.com wrote:

Is it a default on any editor? Pretty sure emacs doesn't do this unless you set it up.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yi-editor/yi/issues/1104#issuecomment-443984733, or mute the thread https://github.com/notifications/unsubscribe-auth/ARyL6_EPqIr0YQy8713fo8Nx5OEaWvk4ks5u1hN8gaJpZM4Y_g6t .

kirelagin commented 5 years ago

According to POSIX, a text file is “a file that contains characters organized into zero or more lines. <...>” and a line is “a sequence of zero or more non- \<newline> characters plus a terminating \<newline> character.”

Thus, the reason many (most?) text editors (at least, traditionally, on UNIX, but not so much on Windows) always make sure that the file they save ends with a newline, is that otherwise it would not qualify as a text file.