summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-01-16 16:52:49 +0100
committerBram Moolenaar <Bram@vim.org>2021-01-16 16:52:49 +0100
commit9ebcf231bdccc1673cc92b20f5190fc577ad29d0 (patch)
treedd3695932bf9aab15caaef14a2589101768bc223
parent351ead09dd365ebdee2bfa27ab22542d4920c779 (diff)
patch 8.2.2363: curpos() does not accept a string argument as beforev8.2.2363
Problem: curpos() does not accept a string argument as before. solution: Make a string argument work again. (Yegappan Lakshmanan, closes #7690
-rw-r--r--src/evalfunc.c3
-rw-r--r--src/testdir/test_cursor_func.vim3
-rw-r--r--src/version.c2
3 files changed, 7 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 61cca01f8a..c9acd4136b 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -2767,7 +2767,8 @@ set_cursorpos(typval_T *argvars, typval_T *rettv, int charcol)
}
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);
if (line < 0)
diff --git a/src/testdir/test_cursor_func.vim b/src/testdir/test_cursor_func.vim
index c09c6837e2..bded15e36a 100644
--- a/src/testdir/test_cursor_func.vim
+++ b/src/testdir/test_cursor_func.vim
@@ -25,6 +25,9 @@ func Test_move_cursor()
" below last line goes to last line
eval [9, 1]->cursor()
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)
diff --git a/src/version.c b/src/version.c
index 73bdc24dc5..81ce6bc295 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2363,
+/**/
2362,
/**/
2361,