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
}
}
- if (str != NULL && *str != NUL)
+ if (str != NULL && metadata.txtlen != 0)
{
char_u *temp_clipboard;
if (lpszMem)
{
- vim_strncpy((char_u *)lpszMem, str, metadata.txtlen);
+ mch_memmove((char_u *)lpszMem, str, metadata.txtlen);
GlobalUnlock(hMem);
}
}