diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 5 | ||||
-rw-r--r-- | src/nvim/eval.lua | 8 |
2 files changed, 8 insertions, 5 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)); } diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 388fd3a7cb..dcc8cf3c8c 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -11129,10 +11129,10 @@ M.funcs = { for infinite and NaN floating-point values representations which use |str2float()|. Strings are also dumped literally, only single quote is escaped, which does not allow using YAML - for parsing back binary strings. |eval()| should always work for - strings and floats though and this is the only official - method, use |msgpackdump()| or |json_encode()| if you need to - share data with other application. + for parsing back binary strings. |eval()| should always work + for strings and floats though, and this is the only official + method. Use |msgpackdump()| or |json_encode()| if you need to + share data with other applications. ]=], name = 'string', |