]> granicus.if.org Git - vim/commitdiff
patch 8.2.2670: Vim9: error for append(0, text) v8.2.2670
authorBram Moolenaar <Bram@vim.org>
Sun, 28 Mar 2021 13:46:16 +0000 (15:46 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 28 Mar 2021 13:46:16 +0000 (15:46 +0200)
Problem:    Vim9: error for append(0, text).
Solution:   Check for negative number. (closes #8022)

src/testdir/test_vim9_builtin.vim
src/typval.c
src/version.c

index 73251c0baceb67ca3349fffa8eb8c444d16f2155..8f112174e51756ccab64f3ba93addb89de797b45 100644 (file)
@@ -123,6 +123,10 @@ def Test_append()
   var res2: bool = append(3, 'two')
   assert_equal(false, res2)
   assert_equal(['0', 'one', '1', 'two', '2'], getline(1, 6))
+
+  append(0, 'zero')
+  assert_equal('zero', getline(1))
+  bwipe!
 enddef
 
 def Test_balloon_show()
index 8030c6953f291e523b0ba8629361707e0c6d5059..ca561ddbf7b40e4a573fb78bbb2242bbf5a7d2f4 100644 (file)
@@ -1621,7 +1621,7 @@ tv_get_lnum(typval_T *argvars)
 
     if (argvars[0].v_type != VAR_STRING || !in_vim9script())
        lnum = (linenr_T)tv_get_number_chk(&argvars[0], NULL);
-    if (lnum <= 0)  // no valid number, try using arg like line()
+    if (lnum < 0)  // no valid number, try using arg like line()
     {
        int     fnum;
        pos_T   *fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE);
index 00d2fd74a35808753f98cb8c1c66a99e574750fc..1f389e9ef74a721696c50fb5c2512233e6ac5459 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2670,
 /**/
     2669,
 /**/