PreviousNextTracker indexSee it online !

(210/239) 3900 - Extra crlf being added to the end of the file every time

version 5.1 on windows 8 with java 1.7.0_72
line separator is set to crlf
I'm saving file with no additional empty line at the end. If I press ctrl+end the caret will stop the end of last word.
And when I open this file in another editor (nontepad2) I see empty line at the end. I also viewed it with hex editor. there is 0D0A at end too.
And if I add last empty line at the end in jEdit, I'm getting 0D0A0D0A in hex editor and 2 empty lines in notepad2.

Submitted guai-x - 2014-12-29 11:56:43.925000 Assigned
Priority 5 Labels line separator line ending crlf cr lf linesep
Status pending Group severe bug
Resolution invalid

Comments

2014-12-29 13:07:32.467000
guai-x

Newly created and saved file already contains 0D0A

2015-01-10 22:44:32.855000
goodvibes2

Hi Guai,

Your description is not clear to me about what the problem is.

Are you saying that if you 'save as' an empty file, it should not contain just crlf
or
are you saying if you save a file with just 1 line, it has crlfcrlf at the end
or
are you say if you save a file with just 1 line, it should not have any crlf at end?

I cannot test windows 8, but for me (windows 7, jEdit 5.1.0, Java 1.8.0_20),
if I save a file containing just 1 word 'test', then the jEdit Hex plugin shows
0000000: 74 65 73 74 0d 0a              ;test..
and has a size of 6 bytes which is what I expect.

2015-01-20 07:53:09.324000
kpouer

- **status**: open --> pending-invalid

2015-01-20 07:53:10.782000
kpouer

Hi, it is not a bug but a feature :)
I don't know the reason but in unix, if you are coding, for example some C, if your last line is not an empty line, the compiler is not happy.
So jEdit adds an hidden empty line at the end of the file (vi does the same).
There is an option for that in
Global Options->Text Area
At the end of the screen, look at the checkbox "Hide final end of line (if any)"