To: vim_dev@googlegroups.com Subject: Patch 8.2.2843 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2843 (after 8.2.2842) Problem: Vim9: skip argument to searchpairpos() is not compiled. Solution: Handle like searchpair(). Also for search() and searchpos(). Files: src/vim9compile.c, src/testdir/test_vim9_builtin.vim *** ../vim-8.2.2842/src/vim9compile.c 2021-05-07 17:55:51.967584415 +0200 --- src/vim9compile.c 2021-05-07 19:42:58.852638942 +0200 *************** *** 3285,3292 **** vim_strncpy(namebuf, *arg, varlen); name = fname_trans_sid(namebuf, fname_buf, &tofree, &error); ! // we handle the "skip" argument of searchpair() differently ! is_searchpair = (varlen == 10 && STRNCMP(*arg, "searchpair", 10) == 0); *arg = skipwhite(*arg + varlen + 1); if (compile_arguments(arg, cctx, &argcount, is_searchpair) == FAIL) --- 3285,3296 ---- vim_strncpy(namebuf, *arg, varlen); name = fname_trans_sid(namebuf, fname_buf, &tofree, &error); ! // We handle the "skip" argument of searchpair() and searchpairpos() ! // differently. ! is_searchpair = (varlen == 6 && STRNCMP(*arg, "search", 6) == 0) ! || (varlen == 9 && STRNCMP(*arg, "searchpos", 9) == 0) ! || (varlen == 10 && STRNCMP(*arg, "searchpair", 10) == 0) ! || (varlen == 13 && STRNCMP(*arg, "searchpairpos", 13) == 0); *arg = skipwhite(*arg + varlen + 1); if (compile_arguments(arg, cctx, &argcount, is_searchpair) == FAIL) *** ../vim-8.2.2842/src/testdir/test_vim9_builtin.vim 2021-05-07 17:55:51.979584412 +0200 --- src/testdir/test_vim9_builtin.vim 2021-05-07 19:42:34.308690059 +0200 *************** *** 958,963 **** --- 958,977 ---- search('bar', 'W', 0, 0, () => 1)->assert_equal(0) assert_fails("search('bar', '', 0, 0, () => -1)", 'E1023:') assert_fails("search('bar', '', 0, 0, () => -1)", 'E1023:') + + setline(1, "find this word") + normal gg + var col = 7 + assert_equal(1, search('this', '', 0, 0, 'col(".") > col')) + normal 0 + assert_equal([1, 6], searchpos('this', '', 0, 0, 'col(".") > col')) + + col = 5 + normal 0 + assert_equal(0, search('this', '', 0, 0, 'col(".") > col')) + normal 0 + assert_equal([0, 0], searchpos('this', '', 0, 0, 'col(".") > col')) + bwipe! enddef def Test_searchcount() *************** *** 977,990 **** --- 991,1011 ---- def Test_searchpair() new setline(1, "here { and } there") + normal f{ var col = 15 assert_equal(1, searchpair('{', '', '}', '', 'col(".") > col')) assert_equal(12, col('.')) + normal 0f{ + assert_equal([1, 12], searchpairpos('{', '', '}', '', 'col(".") > col')) + col = 8 normal 0f{ assert_equal(0, searchpair('{', '', '}', '', 'col(".") > col')) assert_equal(6, col('.')) + normal 0f{ + assert_equal([0, 0], searchpairpos('{', '', '}', '', 'col(".") > col')) + bwipe! enddef *** ../vim-8.2.2842/src/version.c 2021-05-07 17:55:51.979584412 +0200 --- src/version.c 2021-05-07 19:31:20.902095082 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2843, /**/ -- Marriage isn't a word. It's a sentence. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///