patch 9.1.1232: Vim script is missing the tuple data type

Problem:  Vim script is missing the tuple data type
Solution: Add support for the tuple data type
          (Yegappan Lakshmanan)

closes: #16776

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2025-03-23 16:42:16 +01:00
committed by Christian Brabandt
parent adb703e1b9
commit 9cb865e95b
75 changed files with 7155 additions and 691 deletions

View File

@ -1263,6 +1263,7 @@ read_viminfo_varlist(vir_T *virp, int writing)
case 'L': type = VAR_LIST; break;
case 'B': type = VAR_BLOB; break;
case 'X': type = VAR_SPECIAL; break;
case 'T': type = VAR_TUPLE; break;
}
tab = vim_strchr(tab, '\t');
@ -1270,7 +1271,8 @@ read_viminfo_varlist(vir_T *virp, int writing)
{
tv.v_type = type;
if (type == VAR_STRING || type == VAR_DICT
|| type == VAR_LIST || type == VAR_BLOB)
|| type == VAR_LIST || type == VAR_BLOB
|| type == VAR_TUPLE)
tv.vval.v_string = viminfo_readstring(virp,
(int)(tab - virp->vir_line + 1), TRUE);
else if (type == VAR_FLOAT)
@ -1282,7 +1284,7 @@ read_viminfo_varlist(vir_T *virp, int writing)
|| tv.vval.v_number == VVAL_TRUE))
tv.v_type = VAR_BOOL;
}
if (type == VAR_DICT || type == VAR_LIST)
if (type == VAR_DICT || type == VAR_LIST || type == VAR_TUPLE)
{
typval_T *etv = eval_expr(tv.vval.v_string, NULL);
@ -1370,7 +1372,7 @@ write_viminfo_varlist(FILE *fp)
s = "DIC";
if (di != NULL && !set_ref_in_ht(
&di->dv_hashtab, copyID, NULL)
&di->dv_hashtab, copyID, NULL, NULL)
&& di->dv_copyID == copyID)
// has a circular reference, can't turn the
// value into a string
@ -1384,13 +1386,27 @@ write_viminfo_varlist(FILE *fp)
s = "LIS";
if (l != NULL && !set_ref_in_list_items(
l, copyID, NULL)
l, copyID, NULL, NULL)
&& l->lv_copyID == copyID)
// has a circular reference, can't turn the
// value into a string
continue;
break;
}
case VAR_TUPLE:
{
tuple_T *tuple = this_var->di_tv.vval.v_tuple;
int copyID = get_copyID();
s = "TUP";
if (tuple != NULL && !set_ref_in_tuple_items(
tuple, copyID, NULL, NULL)
&& tuple->tv_copyID == copyID)
// has a circular reference, can't turn the
// value into a string
continue;
break;
}
case VAR_BLOB: s = "BLO"; break;
case VAR_BOOL: s = "XPL"; break; // backwards compat.
case VAR_SPECIAL: s = "XPL"; break;