Skip to content

Commit 9ebcf23

Browse files
committed
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 #7690
1 parent 351ead0 commit 9ebcf23

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/evalfunc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2767,7 +2767,8 @@ set_cursorpos(typval_T *argvars, typval_T *rettv, int charcol)
27672767
}
27682768
else if ((argvars[0].v_type == VAR_NUMBER ||
27692769
argvars[0].v_type == VAR_STRING)
2770-
&& argvars[1].v_type == VAR_NUMBER)
2770+
&& (argvars[1].v_type == VAR_NUMBER ||
2771+
argvars[1].v_type == VAR_STRING))
27712772
{
27722773
line = tv_get_lnum(argvars);
27732774
if (line < 0)

src/testdir/test_cursor_func.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ func Test_move_cursor()
2525
" below last line goes to last line
2626
eval [9, 1]->cursor()
2727
call assert_equal([4, 1, 0, 1], getcurpos()[1:])
28+
" pass string arguments
29+
call cursor('3', '3')
30+
call assert_equal([3, 3, 0, 3], getcurpos()[1:])
2831

2932
call setline(1, ["\<TAB>"])
3033
call cursor(1, 1, 1)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2363,
753755
/**/
754756
2362,
755757
/**/

0 commit comments

Comments
 (0)