Patch 8.2.1039

4 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 22, 2020, 2:35:00 PM6/22/20
to vim...@googlegroups.com

Patch 8.2.1039
Problem: Cannot put NUL byte on clipboard.
Solution: Use the text length. (Christian Brabandt, closes #6312,
closes #6149)
Files: src/winclip.c, src/testdir/test_registers.vim


*** ../vim-8.2.1038/src/winclip.c 2020-02-12 21:15:37.543497435 +0100
--- src/winclip.c 2020-06-22 20:23:56.519089919 +0200
***************
*** 422,428 ****
}
}

! if (str != NULL && *str != NUL)
{
char_u *temp_clipboard;

--- 422,428 ----
}
}

! if (str != NULL && metadata.txtlen != 0)
{
char_u *temp_clipboard;

***************
*** 543,549 ****

if (lpszMem)
{
! vim_strncpy((char_u *)lpszMem, str, metadata.txtlen);
GlobalUnlock(hMem);
}
}
--- 543,549 ----

if (lpszMem)
{
! mch_memmove((char_u *)lpszMem, str, metadata.txtlen);
GlobalUnlock(hMem);
}
}
*** ../vim-8.2.1038/src/testdir/test_registers.vim 2020-06-22 19:10:51.689755096 +0200
--- src/testdir/test_registers.vim 2020-06-22 20:23:56.519089919 +0200
***************
*** 641,644 ****
--- 641,662 ----
call assert_equal(repeat('abcdefghijklmnopqrstuvwxyz', 312), str)
endfunc

+ " Test for clipboard registers with ASCII NUL
+ func Test_clipboard_nul()
+ CheckFeature clipboard_working
+ new
+
+ " Test for putting ASCII NUL into the clipboard
+ set clipboard=unnamed
+ call append(0, "\ntest")
+ normal ggyyp
+ call assert_equal("^@test^@", strtrans(getreg('*')))
+ call assert_equal(getline(1), getline(2))
+ let b = split(execute(":reg *"), "\n")
+ call assert_match('"\*\s*\^@test\^J',b[1])
+
+ set clipboard&vim
+ bwipe!
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.1038/src/version.c 2020-06-22 20:22:15.683211781 +0200
--- src/version.c 2020-06-22 20:25:08.018992256 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1039,
/**/

--
I bought a book on hair loss, but the pages kept falling out.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages