1
0
forked from aniani/vim

patch 9.1.0329: String interpolation fails for Dict type

Problem:  String interpolation fails for Dict type
Solution: Support Dict data type properly, also support :put =Dict
          (without having to convert it to string() first)
          (Yegappan Lakshmanan)

fixes: #14529
closes: #14541

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2024-04-14 23:21:02 +02:00
committed by Christian Brabandt
parent 0d87e3c711
commit f01493c550
10 changed files with 43 additions and 7 deletions

View File

@@ -575,7 +575,8 @@ skip_expr_concatenate(
/*
* Convert "tv" to a string.
* When "convert" is TRUE convert a List into a sequence of lines.
* When "convert" is TRUE convert a List into a sequence of lines and a Dict
* into a textual representation of the Dict.
* Returns an allocated string (NULL when out of memory).
*/
char_u *
@@ -596,6 +597,8 @@ typval2string(typval_T *tv, int convert)
ga_append(&ga, NUL);
retval = (char_u *)ga.ga_data;
}
else if (convert && tv->v_type == VAR_DICT)
retval = dict2string(tv, get_copyID(), FALSE);
else
retval = vim_strsave(tv_get_string(tv));
return retval;