VirtualBox

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


Ignore:
Timestamp:
May 22, 2024 2:32:06 PM (9 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
163326
Message:

Shared Clipboard: Attempt to prevent extra new lines when copying text from Linux to Windows (take care about buf[0] == '\n' as well), bugref:10694.

File:
1 edited

Legend:

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

    r104759 r104760  
    942942            /* Insert '\r' in front of '\n', but avoid '\r\r\n' situations
    943943               because it will result in extra empty lines on the other side. */
    944             if (   i > 1
    945                 && pcwszSrc[i - 1] != VBOX_SHCL_CARRIAGERETURN)
     944            if (   i == 0
     945                || (   i > 1
     946                    && pcwszSrc[i - 1] != VBOX_SHCL_CARRIAGERETURN
     947                   )
     948               )
    946949            {
    947950                pu16Dst[j] = VBOX_SHCL_CARRIAGERETURN;
     
    961964        {
    962965            /* Set CR.r, but avoid '\r\r'. */
    963             if (   i > 1
    964                 && pcwszSrc[i - 1] != VBOX_SHCL_CARRIAGERETURN)
     966            if (   i == 0
     967                || (   i > 1
     968                    && pcwszSrc[i - 1] != VBOX_SHCL_CARRIAGERETURN
     969                   )
     970               )
    965971            {
    966972                pu16Dst[j] = VBOX_SHCL_CARRIAGERETURN;
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