0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 8.2.1241: cannot use getbufinfo() as a method

Problem:    Cannot use getbufinfo() as a method.
Solution:   Support using getbufinfo() as a method. (closes #6458)
This commit is contained in:
Bram Moolenaar
2020-07-18 22:24:22 +02:00
parent 10e1d01aaf
commit 6434fc574d
4 changed files with 10 additions and 2 deletions

View File

@@ -4929,8 +4929,11 @@ getbufinfo([{dict}])
< <
To get buffer-local options use: > To get buffer-local options use: >
getbufvar({bufnr}, '&option_name') getbufvar({bufnr}, '&option_name')
< <
Can also be used as a |method|: >
GetBufnr()->getbufinfo()
<
*getbufline()* *getbufline()*
getbufline({expr}, {lnum} [, {end}]) getbufline({expr}, {lnum} [, {end}])
Return a |List| with the lines starting from {lnum} to {end} Return a |List| with the lines starting from {lnum} to {end}

View File

@@ -611,7 +611,7 @@ static funcentry_T global_functions[] =
{"function", 1, 3, FEARG_1, ret_f_function, f_function}, {"function", 1, 3, FEARG_1, ret_f_function, f_function},
{"garbagecollect", 0, 1, 0, ret_void, f_garbagecollect}, {"garbagecollect", 0, 1, 0, ret_void, f_garbagecollect},
{"get", 2, 3, FEARG_1, ret_any, f_get}, {"get", 2, 3, FEARG_1, ret_any, f_get},
{"getbufinfo", 0, 1, 0, ret_list_dict_any, f_getbufinfo}, {"getbufinfo", 0, 1, FEARG_1, ret_list_dict_any, f_getbufinfo},
{"getbufline", 2, 3, FEARG_1, ret_list_string, f_getbufline}, {"getbufline", 2, 3, FEARG_1, ret_list_string, f_getbufline},
{"getbufvar", 2, 3, FEARG_1, ret_any, f_getbufvar}, {"getbufvar", 2, 3, FEARG_1, ret_any, f_getbufvar},
{"getchangelist", 0, 1, FEARG_1, ret_list_any, f_getchangelist}, {"getchangelist", 0, 1, FEARG_1, ret_list_any, f_getchangelist},

View File

@@ -23,6 +23,9 @@ func Test_getbufwintabinfo()
call assert_equal('vim', l[0].variables.editor) call assert_equal('vim', l[0].variables.editor)
call assert_notequal(-1, index(l[0].windows, '%'->bufwinid())) call assert_notequal(-1, index(l[0].windows, '%'->bufwinid()))
let l = '%'->getbufinfo()
call assert_equal(bufnr('%'), l[0].bufnr)
" Test for getbufinfo() with 'bufmodified' " Test for getbufinfo() with 'bufmodified'
call assert_equal(0, len(getbufinfo({'bufmodified' : 1}))) call assert_equal(0, len(getbufinfo({'bufmodified' : 1})))
call setbufline('Xtestfile1', 1, ["Line1"]) call setbufline('Xtestfile1', 1, ["Line1"])

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1241,
/**/ /**/
1240, 1240,
/**/ /**/