OSDN Git Service

BUG: [ 1904355 ] Copy&Paste from VB6 add binary chars
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Mon, 3 Mar 2008 15:32:04 +0000 (15:32 +0000)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Mon, 3 Mar 2008 15:32:04 +0000 (15:32 +0000)
Docs/Users/ChangeLog.txt
Src/editlib/ccrystaltextview2.cpp

index 5b7935b..9d7dc7b 100644 (file)
@@ -2,6 +2,9 @@ This file summarizes changes in WinMerge releases.
 Numbers in parentheses refer to SourceForge.net tracker item numbers (#XXXXX) or
 to Subversion revision numbers (rXXXXX).
 
+WinMerge 2.8 Release Candidate?
+  BugFix: Copy&Paste from VB6 added binary chars (#1904355)
+
 WinMerge 2.7.7.6 - 2008-02-28 (r5099)
   Remove sintance.h/sintance.cpp as not compatible with GPL (#1886580)
   Automatically switch to mixed-EOL mode when loading files with
index 4091d67..bc2dfbe 100644 (file)
@@ -1215,6 +1215,8 @@ PutToClipboard (LPCTSTR pszText, int cchText)
           GlobalUnlock (hData);
           UINT fmt = GetClipTcharTextFormat();
           bOK = SetClipboardData (fmt, hData) != NULL;
+          if (bOK)
+            SetClipboardData (RegisterClipboardFormat (_T("WinMergeClipboard")), NULL);
         }
       CloseClipboard ();
     }
@@ -1240,6 +1242,20 @@ GetFromClipboard (CString & text)
                 memcpy(text.GetBufferSetLength(cchText), pszData, cbData);
               GlobalUnlock (hData);
               bSuccess = TRUE;
+              BOOL bWinMergeClipboardFormat = FALSE;
+              UINT nFormat = 0;
+              UINT nWinMergeClipboardFormat = RegisterClipboardFormat (_T("WinMergeClipboard"));
+              while (nFormat = EnumClipboardFormats (nFormat))
+                {
+                  if (nFormat == nWinMergeClipboardFormat)
+                    bWinMergeClipboardFormat = TRUE;
+                }
+              if (!bWinMergeClipboardFormat)
+                {
+                  // truncate the data after the first null
+                  CString tmp = (LPCTSTR)text;
+                  text = tmp;
+                }
             }
         }
       CloseClipboard ();