Copy/paste double line spacing

Discussions related to using VirtualBox on Windows hosts.
Post Reply
MadDogBlack
Posts: 2
Joined: 8. Dec 2021, 00:40

Copy/paste double line spacing

Post by MadDogBlack »

When doing copy/paste from Ubuntu to Windows utilities seem to always get double line spacing -- as though LF/CR is being interpreted incorrectly.

Seems to me this is a recent phenomena (I don't remember this always happening but it may have started several versions ago).

Mike
AndyCot
Posts: 296
Joined: 29. Feb 2020, 03:04

Re: Copy/paste double line spacing

Post by AndyCot »

I would on Windows install Notepad++ and enable the "View->Show Symbol->Show End of line" menu option and look at what the EOL is.

Most MS built Windows apps hate Linux's standard EOL.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Copy/paste double line spacing

Post by mpack »

MadDogBlack wrote:When doing copy/paste from Ubuntu to Windows utilities seem to always get double line spacing -- as though LF/CR is being interpreted incorrectly.
I'm not aware that VirtualBox has any role in this at all. I.e. it does not translate text files or clipboard objects for an assumed consumer.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Copy/paste double line spacing

Post by fth0 »

MadDogBlack wrote:When doing copy/paste from Ubuntu to Windows utilities seem to always get double line spacing -- as though LF/CR is being interpreted incorrectly.
This can happen when a text file on Linux uses the Windows style line endings (CR+LF). On Linux, many text editors display only one line break in this case, the X11 clipboard gets the CR+LF, the VirtualBox Shared Clipboard then replaces the LF with CR+LF, because the Windows clipboard requires CR+LF line endings, leading to a CR+CR+LF sequence, which is displayed as two line breaks in Windows text editors.

Note that on Linux, CR is a character like any other, and recognizing the already existing CR+LF sequence wouldn't be the Linux way. Text editors display one line break for the convenience of the users nonetheless.
mpack wrote:I'm not aware that VirtualBox has any role in this at all. I.e. it does not translate text files or clipboard objects for an assumed consumer.
If you'd like to see the issue for yourself, you can try the following: On a Windows host, zip a VBox.log file (or any other Windows text file), copy the zip file to a Linux guest, unzip it, open it in a text editor, copy some lines and paste them in a text editor on the Windows host. In the VirtualBox source code, the main work horse is clipConvertDataFromX11Worker.
Post Reply