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>
diff --git a/src/viminfo.c b/src/viminfo.c
index 5f1ad74..44d5487 100644
--- a/src/viminfo.c
+++ b/src/viminfo.c
@@ -1263,6 +1263,7 @@
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 @@
{
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 @@
|| 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 @@
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 @@
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;