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 vim/vim#5878)
5259275347
This commit is contained in:
Jan Edmund Lazo
2020-04-03 20:36:11 -04:00
parent 366e75b6be
commit 5726272559
3 changed files with 16 additions and 3 deletions

View File

@@ -666,6 +666,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