CR line terminators are pasting as CRLF



  • This might be a bug, but if I create a text file in Notepad++, then do a replace of all the CRLF line terminators with CR I end up with a file that looks like
    Line 1<CR>
    Line 2<CR>
    Line 3<CR>

    If I then copy this text and paste it back into the same document I get
    Line 1<CR><LF>
    Line 2<CR><LF>
    Line 3<CR><LF>

    The text in the clipboard seems to be just the <CR>, so why when I paste it back do I get <CR><LF>?

    Thanks



  • @Jason-Bolstad

    There’s something in the Paste mechanism that examines the line-ending setting for the current file–see the status bar area where it says “Windows (CR LF)” or “Unix (LF)”–and converts anything that looks like a line-ending to THAT format at the time of the pasting.



  • As far as I am concerned this is the desired behavior.
    Line ending style is a property of a file. A file should never have mixed different line endings.
    Copying text (code segments) between files with different endings is common and the fact that Notepad++ converts the line endings according to the destination file style is good.



  • I do agree this is usually the desired behavior. I often copy/paste from various sources and would hate to have all the line endings mixed up.

    That said, there is a way to turn it off. You’d need to install a plugin such as LuaScript or PythonScript so that you can call SCI_SETPASTECONVERTENDINGS and set it tofalse.


Log in to reply