1
0
forked from aniani/vim

patch 9.0.0936: wrong type for "isunnamed" returned by getreginfo()

Problem:    Wrong type for "isunnamed" returned by getreginfo().
Solution:   Use VAR_BOOL instead of VAR_SPECIAL. (closes #11598)
This commit is contained in:
Bram Moolenaar
2022-11-24 11:31:29 +00:00
parent 24482fbfd5
commit 82946e1439
3 changed files with 10 additions and 1 deletions

View File

@@ -8415,7 +8415,7 @@ f_getreginfo(typval_T *argvars, typval_T *rettv)
if (item != NULL)
{
item->di_tv.v_type = VAR_SPECIAL;
item->di_tv.v_type = VAR_BOOL;
item->di_tv.vval.v_number = regname == buf[0]
? VVAL_TRUE : VVAL_FALSE;
(void)dict_add(dict, item);

View File

@@ -520,6 +520,13 @@ func Test_get_reginfo()
nunmap <F2>
unlet g:RegInfo
" The type of "isunnamed" was VAR_SPECIAL but should be VAR_BOOL. Can only
" be noticed when using json_encod().
call setreg('a', 'foo')
let reginfo = getreginfo('a')
let expected = #{regcontents: ['foo'], isunnamed: v:false, regtype: 'v'}
call assert_equal(json_encode(expected), json_encode(reginfo))
bwipe!
endfunc

View File

@@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
936,
/**/
935,
/**/