]> granicus.if.org Git - vim/commitdiff
patch 8.2.2363: curpos() does not accept a string argument as before v8.2.2363
authorBram Moolenaar <Bram@vim.org>
Sat, 16 Jan 2021 15:52:49 +0000 (16:52 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 16 Jan 2021 15:52:49 +0000 (16:52 +0100)
Problem:    curpos() does not accept a string argument as before.
solution:   Make a string argument work again. (Yegappan Lakshmanan,
            closes #7690

src/evalfunc.c
src/testdir/test_cursor_func.vim
src/version.c

index 61cca01f8a5c951885b6bde9f45de63a43816515..c9acd4136beab39390318d31c70088d4e28fb9fb 100644 (file)
@@ -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)
index c09c6837e20484b83a37fb4b432692f2762cf1df..bded15e36a361f403f2eb4e5e2d482d75659997f 100644 (file)
@@ -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)
index 73bdc24dc5ae272183f64c25232de12670b6ceac..81ce6bc29577c314f6b21b3a3dded182ae12b39c 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2363,
 /**/
     2362,
 /**/