[Geany-devel] "Ensure new line on file end" inserts new line when file is empty

Lex Trotman elextr at xxxxx
Sat Oct 16 10:06:12 UTC 2010


On 16 October 2010 19:52, Eugene Arshinov <earshinov at gmail.com> wrote:
> On Sat, 16 Oct 2010 17:49:27 +1100%
> Lex Trotman <elextr at gmail.com> wrote:
>
>> Hi Eugene,
>>
>> I'm not sure it is a bug, the pref setting is there is to ensure that
>> the file ends in a newline, so an empty file will become just a new
>> line (see od below).  Thats working correctly AFAICT.
>>
>> lex at fred5 ~ $ od untitled
>> 0000000 000012
>> 0000001
>>
>> Cheers
>> Lex
>>
>
> Hi.
>
> Yes, of course it's logical that newline is always added, even for
> empty files.  But it becomes that for non-empty files you get one empty
> line at the end, for empty files -- two empty lines.  It's not quite
> useful and (IMHO) bad.

Well, if the file ends in a newline it will always appear as an empty
line at the end even though there is nothing after the newline, the
only way to avoid it is to not end in newline.  If you don't like the
blank line, delete the newline ... and turn off the preference so
Geany won't add it back again ;-)

But there are some things that REQUIRE the file to end in newline, and
IIUC that is what the "ensure newline at file end" preference is for,
it has to add the newline.  So it isn't a bug if the preference is
selected.

Cheers
Lex

> Best regards,
> Eugene.
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>



More information about the Devel mailing list