diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-02-06 04:46:16 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-02-06 04:46:16 +0800 |
commit | 8c3244c9a1c4b82ab86431f173716ce606b83813 (patch) | |
tree | 0951bf8632da774ca0cf7bd60c0d97458ddcf5fb | |
parent | 6ab71683d14a408e79f7cbda3a07ab65f76c6b35 (diff) | |
download | rneovim-8c3244c9a1c4b82ab86431f173716ce606b83813.tar.gz rneovim-8c3244c9a1c4b82ab86431f173716ce606b83813.tar.bz2 rneovim-8c3244c9a1c4b82ab86431f173716ce606b83813.zip |
vim-patch:8.2.2363: curpos() does not accept a string argument as before
Problem: curpos() does not accept a string argument as before.
solution: Make a string argument work again. (Yegappan Lakshmanan,
closes vim/vim#7690
https://github.com/vim/vim/commit/9ebcf231bdccc1673cc92b20f5190fc577ad29d0
-rw-r--r-- | src/nvim/eval/funcs.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_cursor_func.vim | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index b188ded368..edf6ed3c12 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -1584,7 +1584,7 @@ static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol) set_curswant = false; } } else if ((argvars[0].v_type == VAR_NUMBER || argvars[0].v_type == VAR_STRING) - && argvars[1].v_type == VAR_NUMBER) { + && (argvars[1].v_type == VAR_NUMBER || argvars[1].v_type == VAR_STRING)) { line = tv_get_lnum(argvars); col = (long)tv_get_number_chk(&argvars[1], NULL); if (charcol) { diff --git a/src/nvim/testdir/test_cursor_func.vim b/src/nvim/testdir/test_cursor_func.vim index d8b3ac3fcc..f2ffd50726 100644 --- a/src/nvim/testdir/test_cursor_func.vim +++ b/src/nvim/testdir/test_cursor_func.vim @@ -24,6 +24,9 @@ func Test_move_cursor() " below last line goes to last line call cursor(9, 1) call assert_equal([4, 1, 0, 1], getcurpos()[1:]) + " pass string arguments + call cursor('3', '3') + call assert_equal([3, 3, 0, 3], getcurpos()[1:]) call setline(1, ["\<TAB>"]) call cursor(1, 1, 1) |