lineSplitter ignores the the trailing newline?

Jonathan Marler johnnymarler at gmail.com
Sun Nov 10 05:19:35 UTC 2019


On Sunday, 10 November 2019 at 01:26:10 UTC, Jonathan M Davis 
wrote:
> On Saturday, November 9, 2019 4:07:29 PM MST Jonathan Marler 
> via Digitalmars-d wrote:
>> [...]
>
> Per the POSIX standard, lines are always terminated by a 
> newline.
>
> https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline
>
> Text editors and the like will generally ensure that it's 
> there. Now, I don't see much reason to treat it as an error if 
> you manage to have a text file or other block of text that 
> doesn't end with a newline, since reaching the end of the file 
> or text makes it pretty clear that the line ended. Also, while 
> POSIX and its utilities may be designed to assume that lines 
> always end with newlines (including at the end of a file), 
> Windows doesn't make that same assumption.
>
> - Jonathan M Davis

Thanks for the reference.  I've opened a PR to fix the "tolf" 
tool to keep the trailing newline on each file, or, add a 
trailing newline if it doesn't have one yet: 
https://github.com/dlang/tools/pull/385


More information about the Digitalmars-d mailing list