Menu

unix line endings in 3.5

2006-03-17
2012-11-13
  • tom hirashima

    tom hirashima - 2006-03-17

    hello, i recently upgraded to 3.5 from 3.4 and i have noticed that in my linux development environment, even though i have the file format set to UNIX, it will still show windows line endings when I edit and save files with notepad++. if i change it to windows format and then back to unix and then save, it will show the line endings correctly. I did not notice this behavior previously with 3.4.

     
    • Danny Suls

      Danny Suls - 2006-04-27

      I'm "bumping" this topic, because I noticed a problem that is somewhat similar.

      I'm editing Linux source code files in Notepad++, so all lines end in a newline only.

      As long as keep editing using Notepad++, everything seems to be fine. But when I copy text from another Windows application, it also copies the carriage return characters (but these aren't visible in Notepad++). So when I do this, I have to remove the carriage return characters in a Linux editor afterwards.

      I think this qualifies as a bug. I haven't verified it yet, but I assume other Windows editors that can handle text files in UNIX format automatically strip the <CR> characters from text that gets pasted into the file.

       
      • Don HO

        Don HO - 2006-05-20

        I'll try to fix it in the next (v3.7) release.

        Don

         
        • Nobody/Anonymous

          This must have been missed in versions up to and including 3.8.

          With the Windows notepad++ version editing a Unix/Linux file, the file appears with double the number of line count, and every second line is blank due to the CR/LF issue. 

          Perhaps the filetype detection routine is not seeing the Unix/Linux files as such, and is therefore producing the every-other blank line as described?

           
    • tom hirashima

      tom hirashima - 2006-05-12

      can anyone verify this bug? if so, does anyone know if this was introduced in 3.5, or in a previous release?

       
    • DV

      DV - 2006-05-12

      There is a way to replace all <CR><LF> by <LF> only - as I understand that's what you want.
      At first, check menu View -> Show all characters.
      Then select any <CR><LF> pair (you can do it with Shift+right arrow). Press Ctrl+H (Replace) and you'll see two square symbols in "Find what" field. The first is <CR> and the second is <LF>. So, copy the second square symbol to "Replace With" field and press "Replace All".
      Not the best way, I think, but it works :)

       
    • tom hirashima

      tom hirashima - 2006-05-13

      yes, that is a good way to correct the errors, but it seems like notepad++ is erroneously inserting CRLF in files that are opened in Unix format. I'll run some tests this weekend and see if I can get some definitive steps to reproduce.

       
    • DV

      DV - 2006-05-15

      Some tests:
      1.1. I created a new text file and use 'Format' -> 'Convert to UNIX format'. Then 'Show all characters' was enabled. After entering some text (with a few lines) there were <LF>s only, no <CR>s.
      1.2. When pasting from Windows Clipboard, all new lines are with <LF>s only, no <CR>s.
      2. When I took a text file with <CR><LF> and use 'Format' -> 'Convert to UNIX format', all <CR><LF> have been converted to <LF>.

      So I see no errors.

       
      • Danny Suls

        Danny Suls - 2006-05-17

        DV__: I would like to comment on your tests.

        I'm pretty sure the behaviour you mentioned in point 1.2 ("When pasting from Windows Clipboard"...) is NOT intended behaviour. Actually, I don't think I've ever seen any Windows text editor (that can handle Unix files) behave this way.

        When working with a Unix file, all text lines pasted into it should have the carriage return characters automatically removed.

        In short, I don't agree with you when you write "I see no errors". ;-)

        And I'm a bit disappointed to see that this has still not been fixed in 3.6. I'm running into this problem all the time.

         
        • Danny Suls

          Danny Suls - 2006-05-17

          Whoops!

          Sorry, apparently I managed to completely misread your post (note to self: never post until you've first had some coffee ;-) ).

          Anyway, I think it's very strange, because when I paste text from another Windows application I always get the carriage returns inserted. Maybe I can put some files online to reproduce it.

           
    • tom hirashima

      tom hirashima - 2006-05-15

      here is how i have reproduced it:

      1. open css file on server (linux) with notepad++ over the network. File is unix format.

      2. copy and paste text from local windows formatted css file into remote css file. save remote file on server, supposedly in unix format.

      3. open css file on server with VIM. ^M trails new lines pasted into file.

      This happens more frequently when I am working with firefox's webdeveloper extension and copying and pasting css rules from the css-edit sidebar.

      so is this proper behavior? should it retain the CR characters if pasted in and saved in unix format? or should it be converting CRLF to just LF?

       
    • DV

      DV - 2006-05-19

      Maybe it occurs because of editing over the network (I don't know why - but maybe)?
      Did you try to do the same operations whith 'Show all characters' option on? Do you see <CR> in this case (after pasting from another Windows application)?