# HG changeset patch # User Bram Moolenaar # Date 1616940003 -7200 # Node ID 8b4159943d9a734f0ccf057ea4dbf88252a84871 # Parent 952600bbf45c94d3db02ccfd399883b60f370045 patch 8.2.2670: Vim9: error for append(0, text) Commit: https://github.com/vim/vim/commit/b2ac7d0663ef31a335c50c6afca042ed9ace5059 Author: Bram Moolenaar Date: Sun Mar 28 15:46:16 2021 +0200 patch 8.2.2670: Vim9: error for append(0, text) Problem: Vim9: error for append(0, text). Solution: Check for negative number. (closes https://github.com/vim/vim/issues/8022) diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -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() diff --git a/src/typval.c b/src/typval.c --- a/src/typval.c +++ b/src/typval.c @@ -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); diff --git a/src/version.c b/src/version.c --- 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 */ /**/ + 2670, +/**/ 2669, /**/ 2668,