diff src/winclip.c @ 20976:599b29b6e540 v8.2.1039

patch 8.2.1039: cannot put NUL byte on clipboard Commit: https://github.com/vim/vim/commit/25fd2672875351ff56a925284a03a900081f70c0 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jun 22 20:30:27 2020 +0200 patch 8.2.1039: cannot put NUL byte on clipboard Problem: Cannot put NUL byte on clipboard. Solution: Use the text length. (Christian Brabandt, closes https://github.com/vim/vim/issues/6312, closes #6149)
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Jun 2020 20:45:03 +0200
parents 1e78bf92f168
children fc859aea8cec
line wrap: on
line diff
--- a/src/winclip.c
+++ b/src/winclip.c
@@ -422,7 +422,7 @@ clip_mch_request_selection(Clipboard_T *
 	}
     }
 
-    if (str != NULL && *str != NUL)
+    if (str != NULL && metadata.txtlen != 0)
     {
 	char_u *temp_clipboard;
 
@@ -543,7 +543,7 @@ clip_mch_set_selection(Clipboard_T *cbd)
 
 	if (lpszMem)
 	{
-	    vim_strncpy((char_u *)lpszMem, str, metadata.txtlen);
+	    mch_memmove((char_u *)lpszMem, str, metadata.txtlen);
 	    GlobalUnlock(hMem);
 	}
     }