1
0
forked from aniani/vim

patch 8.2.0507: getbufvar() may get the wrong dictionary

Problem:    Getbufvar() may get the wrong dictionary. (David le Blanc)
Solution:   Check for empty name. (closes #5878)
This commit is contained in:
Bram Moolenaar
2020-04-03 18:43:35 +02:00
parent d1e9dc2723
commit 5259275347
3 changed files with 19 additions and 2 deletions

View File

@@ -841,6 +841,16 @@ func Test_getbufvar()
call assert_equal('iso-8859-2', getbufvar(bufnr('%'), '&fenc'))
close
" Get the b: dict.
let b:testvar = 'one'
new
let b:testvar = 'two'
let thebuf = bufnr()
wincmd w
call assert_equal('two', getbufvar(thebuf, 'testvar'))
call assert_equal('two', getbufvar(thebuf, '').testvar)
bwipe!
set fileformats&
endfunc