Bug/feature request: newline character terminating last line of file

According to the POSIX specification, every line of a text file should be terminated with a newline character, including the last line. Currently, TaskPaper does not insert a newline at end of file; this produces complaints from Git and other commandline tools, as well as erroneously producing a spurious blank line in correctly-formatted files.

The major practical problem this causes is that it becomes invalid to cat TaskPaper files together, since the last and first lines of adjacent files end up munged together. Since newlines are very significant in TaskPaper format, this is more frustrating than it would be in (say) JSON-encoded files. Besides the cat problem, this issue is more a matter of principle than anything else.

I am aware that many popular tools and editors incorrectly treat newlines much the same way TaskPaper does currently, so changing TaskPaper’s default behaviour to force a newline might be an inconvenience for users of those applications. With that in mind, would adding a new optional checkbox to enable newline-at-end-of-file in TaskPaper’s Preferences be viable?

In any case, thanks for a great product! :grin:

3 Likes

Thanks for bringing this up, it’s something that I didn’t know about. Will add.

1 Like

As the post says it would be good to have a way of complying with the POSIX standard but I still want it to be optional, Listacular for some reason puts an empty field at the end of lists to represent the new line. Taskpaper 2 used to drive me spare doing this and I gave up using it (rather than Listacular, which somehow comes back to me every time I consider alternatives).