diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-02 22:10:34 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-02 22:10:34 +0200 |
commit | 6c553f9c04a698ac2e19584f8ea8e2cb7cd98c80 (patch) | |
tree | 2fc156f515d61c19b4e97312439882f8fad9ee1c | |
parent | f966ce5ea24748eed10f708d4f828be44887a559 (diff) |
patch 8.2.1576: Vim9: index() does not take "true" as argumentv8.2.1576
Problem: Vim9: index() does not take "true" as argument.
Solution: Use tv_get_bool_chk(). (closes #6823)
-rw-r--r-- | src/evalfunc.c | 2 | ||||
-rw-r--r-- | src/testdir/test_vim9_func.vim | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 340ecf0958..4f0bb5cea5 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -4944,7 +4944,7 @@ f_index(typval_T *argvars, typval_T *rettv) item = list_find(l, (long)tv_get_number_chk(&argvars[2], &error)); idx = l->lv_u.mat.lv_idx; 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) item = NULL; } diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 11a6ddd015..04f8d7aa7e 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1497,6 +1497,10 @@ def Test_count() assert_equal(0, count('ABC ABC ABC', 'b', false)) enddef +def Test_index() + assert_equal(3, index(['a', 'b', 'a', 'B'], 'b', 2, true)) +enddef + def Test_expand() split SomeFile assert_equal(['SomeFile'], expand('%', true, true)) diff --git a/src/version.c b/src/version.c index 2bf4914601..388be57e3e 100644 --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1576, +/**/ 1575, /**/ 1574, |