mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.2843: Vim9: skip argument to searchpairpos() is not compiled
Problem: Vim9: skip argument to searchpairpos() is not compiled. Solution: Handle like searchpair(). Also for search() and searchpos().
This commit is contained in:
@@ -958,6 +958,20 @@ def Test_search()
|
|||||||
search('bar', 'W', 0, 0, () => 1)->assert_equal(0)
|
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:')
|
||||||
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
|
enddef
|
||||||
|
|
||||||
def Test_searchcount()
|
def Test_searchcount()
|
||||||
@@ -977,14 +991,21 @@ enddef
|
|||||||
def Test_searchpair()
|
def Test_searchpair()
|
||||||
new
|
new
|
||||||
setline(1, "here { and } there")
|
setline(1, "here { and } there")
|
||||||
|
|
||||||
normal f{
|
normal f{
|
||||||
var col = 15
|
var col = 15
|
||||||
assert_equal(1, searchpair('{', '', '}', '', 'col(".") > col'))
|
assert_equal(1, searchpair('{', '', '}', '', 'col(".") > col'))
|
||||||
assert_equal(12, col('.'))
|
assert_equal(12, col('.'))
|
||||||
|
normal 0f{
|
||||||
|
assert_equal([1, 12], searchpairpos('{', '', '}', '', 'col(".") > col'))
|
||||||
|
|
||||||
col = 8
|
col = 8
|
||||||
normal 0f{
|
normal 0f{
|
||||||
assert_equal(0, searchpair('{', '', '}', '', 'col(".") > col'))
|
assert_equal(0, searchpair('{', '', '}', '', 'col(".") > col'))
|
||||||
assert_equal(6, col('.'))
|
assert_equal(6, col('.'))
|
||||||
|
normal 0f{
|
||||||
|
assert_equal([0, 0], searchpairpos('{', '', '}', '', 'col(".") > col'))
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
@@ -750,6 +750,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 */
|
||||||
|
/**/
|
||||||
|
2843,
|
||||||
/**/
|
/**/
|
||||||
2842,
|
2842,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -3285,8 +3285,12 @@ compile_call(
|
|||||||
vim_strncpy(namebuf, *arg, varlen);
|
vim_strncpy(namebuf, *arg, varlen);
|
||||||
name = fname_trans_sid(namebuf, fname_buf, &tofree, &error);
|
name = fname_trans_sid(namebuf, fname_buf, &tofree, &error);
|
||||||
|
|
||||||
// we handle the "skip" argument of searchpair() differently
|
// We handle the "skip" argument of searchpair() and searchpairpos()
|
||||||
is_searchpair = (varlen == 10 && STRNCMP(*arg, "searchpair", 10) == 0);
|
// 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);
|
*arg = skipwhite(*arg + varlen + 1);
|
||||||
if (compile_arguments(arg, cctx, &argcount, is_searchpair) == FAIL)
|
if (compile_arguments(arg, cctx, &argcount, is_searchpair) == FAIL)
|
||||||
|
Reference in New Issue
Block a user