lite icon indicating copy to clipboard operation
lite copied to clipboard

The last line of a file is not displayed if it is empty

Open camelCaseSucks opened this issue 3 years ago • 4 comments

If a file ends with one blank line, it isn't shown in lite. If I save a file with a blank line at the end in lite and open it in another editor, there are 2 blank lines at the end.

using version 1.11, no plugins

camelCaseSucks avatar Nov 27 '20 10:11 camelCaseSucks

Can't reproduce. What editor are you using? Perhaps he adds a dummy line at the end?

Jipok avatar Nov 27 '20 10:11 Jipok

I tried in KDE Kate, micro, and nano. Same result with all 3.

camelCaseSucks avatar Nov 27 '20 11:11 camelCaseSucks

I tried in micro. As I thought, it just adds a dummy line at the end. Try to read your file with cat.

Jipok avatar Nov 27 '20 11:11 Jipok

I confirmed there is a newline character with a hex editor.

Try running echo -n 'test' > test_1 and echo 'test' > test_2, then open both in lite. They should be displayed differently, so that there is a line number 2 in the second file and I can move the cursor down. You'll also notice if you cat both files, the first displays an icon at the end to indicate there is no newline character. When cat prints a newline at the end of the file, your shell prompt is printed on the same line. If there is none, the shell will skip to the next line to avoid printing your prompt on a line with output from the last command.

Oddly enough, vim ignores the newline at the end just like lite, and nano will fake a newline if there is none. micro is the only one that behaves in a way I would consider correct.

camelCaseSucks avatar Nov 27 '20 12:11 camelCaseSucks