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
9ebcf231bd
This commit is contained in:
zeertzjq 2022-02-06 04:46:16 +08:00
parent 6ab71683d1
commit 8c3244c9a1
2 changed files with 4 additions and 1 deletions

View File

@ -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) {

View File

@ -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)