diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-05 18:02:05 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-11-05 18:06:00 +0800 |
commit | 3c0651fb459189f5be6165454810e4476296cb7c (patch) | |
tree | 65e71b652e06fa697b9c332df94f227d0a672472 | |
parent | 8e868d699a9d0b68342d8d460a8f6dd9c075d7a8 (diff) | |
download | rneovim-3c0651fb459189f5be6165454810e4476296cb7c.tar.gz rneovim-3c0651fb459189f5be6165454810e4476296cb7c.tar.bz2 rneovim-3c0651fb459189f5be6165454810e4476296cb7c.zip |
fix(eval): make error number of charidx() same as Vim
-rw-r--r-- | src/nvim/eval/funcs.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_functions.vim | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 1e971791bd..26a5c133da 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -908,7 +908,7 @@ static void f_charidx(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) countcc = (int)tv_get_number(&argvars[2]); } if (countcc < 0 || countcc > 1) { - emsg(_(e_invarg)); + semsg(_(e_using_number_as_bool_nr), countcc); return; } diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 06c995db86..d2603809b9 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1101,8 +1101,8 @@ func Test_charidx() call assert_fails('let x = charidx([], 1)', 'E474:') call assert_fails('let x = charidx("abc", [])', 'E474:') call assert_fails('let x = charidx("abc", 1, [])', 'E474:') - call assert_fails('let x = charidx("abc", 1, -1)', 'E474:') - call assert_fails('let x = charidx("abc", 1, 2)', 'E474:') + call assert_fails('let x = charidx("abc", 1, -1)', 'E1023:') + call assert_fails('let x = charidx("abc", 1, 2)', 'E1023:') endfunc func Test_count() |