Patch 8.2.1563
Problem: Vim9: error when using '%" with setbufvar() or getbufvar().
Solution: Use tv_get_buf_from_arg(). (closes #6816)
Files: src/evalvars.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.1562/src/evalvars.c 2020-08-29 13:39:12.578557657 +0200
--- src/evalvars.c 2020-09-01 23:15:05.231625063 +0200
***************
*** 3662,3671 ****
dictitem_T *v;
int done = FALSE;
- (void)tv_get_number(&argvars[0]); // issue errmsg if type error
varname = tv_get_string_chk(&argvars[1]);
! ++emsg_off;
! buf = tv_get_buf(&argvars[0], FALSE);
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
--- 3662,3669 ----
dictitem_T *v;
int done = FALSE;
varname = tv_get_string_chk(&argvars[1]);
! buf = tv_get_buf_from_arg(&argvars[0]);
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
***************
*** 3717,3724 ****
if (!done && argvars[2].v_type != VAR_UNKNOWN)
// use the default value
copy_tv(&argvars[2], rettv);
-
- --emsg_off;
}
/*
--- 3715,3720 ----
***************
*** 3789,3797 ****
if (check_secure())
return;
- (void)tv_get_number(&argvars[0]); // issue errmsg if type error
varname = tv_get_string_chk(&argvars[1]);
! buf = tv_get_buf(&argvars[0], FALSE);
varp = &argvars[2];
if (buf != NULL && varname != NULL && varp != NULL)
--- 3785,3792 ----
if (check_secure())
return;
varname = tv_get_string_chk(&argvars[1]);
! buf = tv_get_buf_from_arg(&argvars[0]);
varp = &argvars[2];
if (buf != NULL && varname != NULL && varp != NULL)
*** ../vim-8.2.1562/src/testdir/test_vim9_func.vim 2020-09-01
23:05:57.812835372 +0200
--- src/testdir/test_vim9_func.vim 2020-09-01 23:11:26.436140812 +0200
***************
*** 1426,1431 ****
--- 1426,1434 ----
settabwinvar(1, 1, '&ts', 15)
assert_equal(15, &ts)
setlocal ts=8
+
+ setbufvar('%', 'myvar', 123)
+ assert_equal(123, getbufvar('%', 'myvar'))
enddef
def Test_setreg()
*** ../vim-8.2.1562/src/version.c 2020-09-01 23:05:57.812835372 +0200
--- src/version.c 2020-09-01 23:16:18.863445525 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1563,
/**/
--
A vacation is a period of travel during which you find that you
took twice as many clothes and half as much money as you needed.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ 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/202009012117.081LH6Tt3421570%40masaka.moolenaar.net.