To: vim_dev@googlegroups.com Subject: Patch 8.2.0871 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0871 Problem: Cannot use getmarklist() as a method. Solution: Make getmarklist() work as a method. Add one to the column number to match getpos(). (Yegappan Lakshmanan, closes #6176) Files: runtime/doc/eval.txt, src/evalfunc.c, src/mark.c, src/testdir/test_marks.vim *** ../vim-8.2.0870/runtime/doc/eval.txt 2020-05-31 23:11:02.078515702 +0200 --- runtime/doc/eval.txt 2020-06-01 14:12:00.660532581 +0200 *************** *** 5375,5380 **** --- 5385,5392 ---- Refer to |getpos()| for getting information about a specific mark. + Can also be used as a |method|: > + GetBufnr()->getmarklist() getmatches([{win}]) *getmatches()* Returns a |List| with all matches previously defined for the *** ../vim-8.2.0870/src/evalfunc.c 2020-05-31 22:19:52.898638027 +0200 --- src/evalfunc.c 2020-06-01 14:12:00.660532581 +0200 *************** *** 579,585 **** {"getjumplist", 0, 2, FEARG_1, ret_list_any, f_getjumplist}, {"getline", 1, 2, FEARG_1, ret_f_getline, f_getline}, {"getloclist", 1, 2, 0, ret_list_dict_any, f_getloclist}, ! {"getmarklist", 0, 1, 0, ret_list_dict_any, f_getmarklist}, {"getmatches", 0, 1, 0, ret_list_dict_any, f_getmatches}, {"getmousepos", 0, 0, 0, ret_dict_number, f_getmousepos}, {"getpid", 0, 0, 0, ret_number, f_getpid}, --- 579,585 ---- {"getjumplist", 0, 2, FEARG_1, ret_list_any, f_getjumplist}, {"getline", 1, 2, FEARG_1, ret_f_getline, f_getline}, {"getloclist", 1, 2, 0, ret_list_dict_any, f_getloclist}, ! {"getmarklist", 0, 1, FEARG_1, ret_list_dict_any, f_getmarklist}, {"getmatches", 0, 1, 0, ret_list_dict_any, f_getmatches}, {"getmousepos", 0, 0, 0, ret_dict_number, f_getmousepos}, {"getpid", 0, 0, 0, ret_number, f_getpid}, *** ../vim-8.2.0870/src/mark.c 2020-05-31 15:41:53.159138610 +0200 --- src/mark.c 2020-06-01 14:12:00.660532581 +0200 *************** *** 1442,1448 **** list_append_number(lpos, bufnr); list_append_number(lpos, pos->lnum); ! list_append_number(lpos, pos->col); list_append_number(lpos, pos->coladd); if (dict_add_string(d, "mark", mname) == FAIL --- 1442,1448 ---- list_append_number(lpos, bufnr); list_append_number(lpos, pos->lnum); ! list_append_number(lpos, pos->col + 1); list_append_number(lpos, pos->coladd); if (dict_add_string(d, "mark", mname) == FAIL *** ../vim-8.2.0870/src/testdir/test_marks.vim 2020-05-31 15:41:53.159138610 +0200 --- src/testdir/test_marks.vim 2020-06-01 14:12:00.660532581 +0200 *************** *** 269,286 **** mark A call cursor(3, 5) normal mN ! call assert_equal([{'file' : '', 'mark' : "'A", 'pos' : [bufnr(), 1, 0, 0]}, ! \ {'file' : '', 'mark' : "'N", 'pos' : [bufnr(), 3, 4, 0]}], \ getmarklist()) " buffer local marks delmarks! ! call assert_equal([{'mark' : "''", 'pos' : [bufnr(), 1, 0, 0]}, ! \ {'mark' : "'\"", 'pos' : [bufnr(), 1, 0, 0]}], getmarklist(bufnr())) call cursor(2, 2) normal mr ! call assert_equal({'mark' : "'r", 'pos' : [bufnr(), 2, 1, 0]}, ! \ getmarklist(bufnr())[0]) ! call assert_equal([], getmarklist({})) close! endfunc --- 269,286 ---- mark A call cursor(3, 5) normal mN ! call assert_equal([{'file' : '', 'mark' : "'A", 'pos' : [bufnr(), 1, 1, 0]}, ! \ {'file' : '', 'mark' : "'N", 'pos' : [bufnr(), 3, 5, 0]}], \ getmarklist()) " buffer local marks delmarks! ! call assert_equal([{'mark' : "''", 'pos' : [bufnr(), 1, 1, 0]}, ! \ {'mark' : "'\"", 'pos' : [bufnr(), 1, 1, 0]}], getmarklist(bufnr())) call cursor(2, 2) normal mr ! call assert_equal({'mark' : "'r", 'pos' : [bufnr(), 2, 2, 0]}, ! \ bufnr()->getmarklist()[0]) ! call assert_equal([], {}->getmarklist()) close! endfunc *** ../vim-8.2.0870/src/version.c 2020-06-01 14:07:44.269545874 +0200 --- src/version.c 2020-06-01 14:13:49.828100931 +0200 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 871, /**/ -- hundred-and-one symptoms of being an internet addict: 241. You try to look for Net Search even when you're in File Manager. /// 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 ///