0
0
mirror of https://github.com/vim/vim.git synced 2025-10-07 05:54:16 -04:00

patch 9.0.0261: bufload() reads a file even if the name is not a file name

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 #10975)
This commit is contained in:
Bram Moolenaar
2022-08-25 12:45:21 +01:00
parent d6c67629ed
commit 2eddbacd6d
4 changed files with 16 additions and 2 deletions

View File

@@ -2368,6 +2368,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'))