Patch 8.2.2670
Problem: Vim9: error for append(0, text).
Solution: Check for negative number. (closes #8022)
Files: src/typval.c, src/testdir/test_vim9_builtin.vim
*** ../vim-8.2.2669/src/typval.c 2021-03-27 18:59:21.863043173 +0100
--- src/typval.c 2021-03-28 15:43:05.796569142 +0200
***************
*** 1621,1627 ****
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()
{
int fnum;
pos_T *fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE);
--- 1621,1627 ----
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()
{
int fnum;
pos_T *fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE);
*** ../vim-8.2.2669/src/testdir/test_vim9_builtin.vim 2021-03-27
22:20:16.275228566 +0100
--- src/testdir/test_vim9_builtin.vim 2021-03-28 15:42:55.956613672 +0200
***************
*** 123,128 ****
--- 123,132 ----
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()
*** ../vim-8.2.2669/src/version.c 2021-03-28 15:29:39.646657785 +0200
--- src/version.c 2021-03-28 15:46:02.091822864 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2670,
/**/
--
Due knot trussed yore spell chequer two fined awl miss steaks.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202103281347.12SDlGQx870668%40masaka.moolenaar.net.