From cd2d3aa48f3531103a3a355d76394301e7b074df Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 25 Aug 2022 20:23:29 +0800 Subject: vim-patch:9.0.0261: bufload() reads a file even if the name is not a file name (#19944) Problem: bufload() reads a file even if the name is not a file name. (Cyker Way) Solution: Do not read the file when the buffer name is not a file name. (closes vim/vim#10975) https://github.com/vim/vim/commit/2eddbacd6dc17c84e4bdc41e60e81949a36bb973 --- src/nvim/testdir/test_functions.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index b024df5a45..b1f617ceda 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1880,6 +1880,13 @@ func Test_bufadd_bufload() exe 'bwipe ' .. buf2 call assert_equal(0, bufexists(buf2)) + " when 'buftype' is "nofile" then bufload() does not read the file + bwipe! XotherName + let buf = bufadd('XotherName') + call setbufvar(buf, '&bt', 'nofile') + call bufload(buf) + call assert_equal([''], getbufline(buf, 1, '$')) + bwipe someName bwipe XotherName call assert_equal(0, bufexists('someName')) -- cgit