diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-15 07:11:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-15 07:11:39 +0800 |
commit | 43f8d7e3ef2db733f01f2d4c03214cd90c5a09be (patch) | |
tree | 002e8a305a2217ce1b6f7f7ab7fef548fcd6b8b7 /src/nvim/eval.c | |
parent | 7180ef690180cf92d1d49811820c46dd60e4d1c6 (diff) | |
download | rneovim-43f8d7e3ef2db733f01f2d4c03214cd90c5a09be.tar.gz rneovim-43f8d7e3ef2db733f01f2d4c03214cd90c5a09be.tar.bz2 rneovim-43f8d7e3ef2db733f01f2d4c03214cd90c5a09be.zip |
vim-patch:9.1.0329: String interpolation fails for Dict type (#28335)
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: vim/vim#14529
closes: vim/vim#14541
https://github.com/vim/vim/commit/f01493c55062c01b1cdf9b1e946577f4d1bdddf3
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 10e9c3ea7f..6480d6e305 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -969,7 +969,8 @@ int skip_expr(char **pp, evalarg_T *const evalarg) /// Convert "tv" to a string. /// -/// @param convert when true convert a List into a sequence of lines. +/// @param convert when true convert a List into a sequence of lines +/// and a Dict into a textual representation of the Dict. /// /// @return an allocated string. static char *typval2string(typval_T *tv, bool convert) @@ -985,6 +986,8 @@ static char *typval2string(typval_T *tv, bool convert) } ga_append(&ga, NUL); return (char *)ga.ga_data; + } else if (convert && tv->v_type == VAR_DICT) { + return encode_tv2string(tv, NULL); } return xstrdup(tv_get_string(tv)); } |