To: vim_dev@googlegroups.com Subject: Patch 8.2.1241 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1241 Problem: Cannot use getbufinfo() as a method. Solution: Support using getbufinfo() as a method. (closes #6458) Files: runtime/doc/eval.txt, src/evalfunc.c, src/testdir/test_bufwintabinfo.vim *** ../vim-8.2.1240/runtime/doc/eval.txt 2020-07-09 19:16:31.374955729 +0200 --- runtime/doc/eval.txt 2020-07-18 22:18:47.187018604 +0200 *************** *** 4904,4911 **** < To get buffer-local options use: > getbufvar({bufnr}, '&option_name') - < *getbufline()* getbufline({expr}, {lnum} [, {end}]) Return a |List| with the lines starting from {lnum} to {end} --- 4929,4939 ---- < To get buffer-local options use: > getbufvar({bufnr}, '&option_name') < + Can also be used as a |method|: > + GetBufnr()->getbufinfo() + < + *getbufline()* getbufline({expr}, {lnum} [, {end}]) Return a |List| with the lines starting from {lnum} to {end} *** ../vim-8.2.1240/src/evalfunc.c 2020-07-09 22:53:27.361738186 +0200 --- src/evalfunc.c 2020-07-18 22:18:06.655110979 +0200 *************** *** 611,617 **** {"function", 1, 3, FEARG_1, ret_f_function, f_function}, {"garbagecollect", 0, 1, 0, ret_void, f_garbagecollect}, {"get", 2, 3, FEARG_1, ret_any, f_get}, ! {"getbufinfo", 0, 1, 0, ret_list_dict_any, f_getbufinfo}, {"getbufline", 2, 3, FEARG_1, ret_list_string, f_getbufline}, {"getbufvar", 2, 3, FEARG_1, ret_any, f_getbufvar}, {"getchangelist", 0, 1, FEARG_1, ret_list_any, f_getchangelist}, --- 611,617 ---- {"function", 1, 3, FEARG_1, ret_f_function, f_function}, {"garbagecollect", 0, 1, 0, ret_void, f_garbagecollect}, {"get", 2, 3, FEARG_1, ret_any, f_get}, ! {"getbufinfo", 0, 1, FEARG_1, ret_list_dict_any, f_getbufinfo}, {"getbufline", 2, 3, FEARG_1, ret_list_string, f_getbufline}, {"getbufvar", 2, 3, FEARG_1, ret_any, f_getbufvar}, {"getchangelist", 0, 1, FEARG_1, ret_list_any, f_getchangelist}, *** ../vim-8.2.1240/src/testdir/test_bufwintabinfo.vim 2020-04-25 15:24:40.551354115 +0200 --- src/testdir/test_bufwintabinfo.vim 2020-07-18 22:19:37.846902337 +0200 *************** *** 23,28 **** --- 23,31 ---- call assert_equal('vim', l[0].variables.editor) call assert_notequal(-1, index(l[0].windows, '%'->bufwinid())) + let l = '%'->getbufinfo() + call assert_equal(bufnr('%'), l[0].bufnr) + " Test for getbufinfo() with 'bufmodified' call assert_equal(0, len(getbufinfo({'bufmodified' : 1}))) call setbufline('Xtestfile1', 1, ["Line1"]) *** ../vim-8.2.1240/src/version.c 2020-07-18 22:03:07.661076057 +0200 --- src/version.c 2020-07-18 22:21:18.054669950 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1241, /**/ -- Those who live by the sword get shot by those who don't. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///