VirtualBox

Changeset 104759 in vbox for trunk/src/VBox/GuestHost


Ignore:
Timestamp:
May 22, 2024 1:59:29 PM (9 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
163324
Message:

Shared Clipboard: Attempt to prevent extra new lines when copying text from Linux to Windows, bugref:10694.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp

    r102815 r104759  
    940940        if (pcwszSrc[i] == VBOX_SHCL_LINEFEED)
    941941        {
    942             pu16Dst[j] = VBOX_SHCL_CARRIAGERETURN;
    943             ++j;
     942            /* Insert '\r' in front of '\n', but avoid '\r\r\n' situations
     943               because it will result in extra empty lines on the other side. */
     944            if (   i > 1
     945                && pcwszSrc[i - 1] != VBOX_SHCL_CARRIAGERETURN)
     946            {
     947                pu16Dst[j] = VBOX_SHCL_CARRIAGERETURN;
     948                ++j;
     949            }
    944950
    945951            /* Not enough space in destination? */
     
    954960        else if (pcwszSrc[i] == VBOX_SHCL_CARRIAGERETURN)
    955961        {
    956             /* Set CR.r */
    957             pu16Dst[j] = VBOX_SHCL_CARRIAGERETURN;
    958             ++j;
     962            /* Set CR.r, but avoid '\r\r'. */
     963            if (   i > 1
     964                && pcwszSrc[i - 1] != VBOX_SHCL_CARRIAGERETURN)
     965            {
     966                pu16Dst[j] = VBOX_SHCL_CARRIAGERETURN;
     967                ++j;
     968            }
    959969
    960970            /* Not enough space in destination? */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette