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

patch 8.2.1576: Vim9: index() does not take "true" as argument

Problem:    Vim9: index() does not take "true" as argument.
Solution:   Use tv_get_bool_chk(). (closes #6823)
This commit is contained in:
Bram Moolenaar
2020-09-02 22:10:34 +02:00
parent f966ce5ea2
commit 6c553f9c04
3 changed files with 7 additions and 1 deletions

View File

@@ -4944,7 +4944,7 @@ f_index(typval_T *argvars, typval_T *rettv)
item = list_find(l, (long)tv_get_number_chk(&argvars[2], &error)); item = list_find(l, (long)tv_get_number_chk(&argvars[2], &error));
idx = l->lv_u.mat.lv_idx; idx = l->lv_u.mat.lv_idx;
if (argvars[3].v_type != VAR_UNKNOWN) if (argvars[3].v_type != VAR_UNKNOWN)
ic = (int)tv_get_number_chk(&argvars[3], &error); ic = (int)tv_get_bool_chk(&argvars[3], &error);
if (error) if (error)
item = NULL; item = NULL;
} }

View File

@@ -1497,6 +1497,10 @@ def Test_count()
assert_equal(0, count('ABC ABC ABC', 'b', false)) assert_equal(0, count('ABC ABC ABC', 'b', false))
enddef enddef
def Test_index()
assert_equal(3, index(['a', 'b', 'a', 'B'], 'b', 2, true))
enddef
def Test_expand() def Test_expand()
split SomeFile split SomeFile
assert_equal(['SomeFile'], expand('%', true, true)) assert_equal(['SomeFile'], expand('%', true, true))

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 */
/**/
1576,
/**/ /**/
1575, 1575,
/**/ /**/