Menu

#3900 Extra crlf being added to the end of the file every time

severe bug
closed
nobody
5
2015-12-21
2014-12-29
guai
No

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.

Discussion

  • guai

    guai - 2014-12-29

    Newly created and saved file already contains 0D0A

     
  • Goodvibes2

    Goodvibes2 - 2015-01-10

    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.

     
  • Matthieu Casanova

    • status: open --> pending-invalid
     
  • Matthieu Casanova

    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)"

     
  • Dale Anson

    Dale Anson - 2015-12-21
    • status: pending-invalid --> closed
     

Log in to post a comment.