diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-03-28 15:46:16 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-03-28 15:46:16 +0200 |
commit | b2ac7d0663ef31a335c50c6afca042ed9ace5059 (patch) | |
tree | e0fe993690e2988d719b7fff79d7bef0679420e2 /src | |
parent | df749a2b9cab579b8c0ca6ca91889aa03d2da704 (diff) |
patch 8.2.2670: Vim9: error for append(0, text)v8.2.2670
Problem: Vim9: error for append(0, text).
Solution: Check for negative number. (closes #8022)
Diffstat (limited to 'src')
-rw-r--r-- | src/testdir/test_vim9_builtin.vim | 4 | ||||
-rw-r--r-- | src/typval.c | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index 73251c0bac..8f112174e5 100644 --- 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 index 8030c6953f..ca561ddbf7 100644 --- 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 index 00d2fd74a3..1f389e9ef7 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 */ /**/ + 2670, +/**/ 2669, /**/ 2668, |