Open DHowett opened 4 years ago
I tried to reproduce both via shift+select with mouse after Ctrl+O followed by ctrl+C and also by shift+right arrow key and ctrl+C in the Far text editor, and neither copied an extra line ending, and they correctly copied a line ending in the middle when I select two lines. I also tried vertical selection via alt+shift+click and it also seems to work OK.
Perhaps this behavior is due to the fact that all EOL characters (CR and LF) are non-printable and cannot be in the scrollback buffer, and Far Manager uses ReadConsoleOutput Win32 API to capture the contents of the scrollback, and then possibly prints it as a rectangular block to the Ctrl+O screen. From the terminal's point of view, the content of the scrollback after that is a fullscreen rectangular area filled with colored cells (black is also a color; a whitespace is also a character). Therefore, logically, when you copy a linear selection with the terminal (e.g. Shift+LeftMouseDrag), the terminal should concatenate successive lines into one long line. While the terminal can apply some heuristics to detect line endings, this doesn't always work.
When you copy a rectangular selection block (using +Alt modifier), the terminal explicitly inserts a line endings after each copied row.
It appears that some time between RS5 and 19H1 we changed how line wrapping/unwrapping works and now FAR manager gets wrapped on copy.
Notes from internal filer
MSFT:28821591