summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/eval.c b/src/eval.c
index c35def0b2..b8e606443 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -5683,9 +5683,9 @@ get_var_special_name(int nr)
* If the memory is allocated "tofree" is set to it, otherwise NULL.
* "numbuf" is used for a number.
* When "copyID" is not NULL replace recursive lists and dicts with "...".
- * When both "echo_style" and "dict_val" are FALSE, put quotes around stings as
- * "string()", otherwise does not put quotes around strings, as ":echo"
- * displays values.
+ * When both "echo_style" and "composite_val" are FALSE, put quotes around
+ * stings as "string()", otherwise does not put quotes around strings, as
+ * ":echo" displays values.
* When "restore_copyID" is FALSE, repeated items in dictionaries and lists
* are replaced with "...".
* May return NULL.
@@ -5698,7 +5698,7 @@ echo_string_core(
int copyID,
int echo_style,
int restore_copyID,
- int dict_val)
+ int composite_val)
{
static int recurse = 0;
char_u *r = NULL;
@@ -5721,10 +5721,12 @@ echo_string_core(
switch (tv->v_type)
{
case VAR_STRING:
- if (echo_style && !dict_val)
+ if (echo_style && !composite_val)
{
*tofree = NULL;
- r = get_tv_string_buf(tv, numbuf);
+ r = tv->vval.v_string;
+ if (r == NULL)
+ r = (char_u *)"";
}
else
{
@@ -5841,10 +5843,19 @@ echo_string_core(
case VAR_NUMBER:
case VAR_UNKNOWN:
+ *tofree = NULL;
+ r = get_tv_string_buf(tv, numbuf);
+ break;
+
case VAR_JOB:
case VAR_CHANNEL:
*tofree = NULL;
r = get_tv_string_buf(tv, numbuf);
+ if (composite_val)
+ {
+ *tofree = string_quote(r, FALSE);
+ r = *tofree;
+ }
break;
case VAR_FLOAT: