#define COPYID_INC 2
#define COPYID_MASK (~0x1)
+/* Abort conversion to string after a recursion error. */
+static int did_echo_string_emsg = FALSE;
+
/*
* Array to hold the hashtab with variables local to each sourced script.
* Each item holds a variable (nameless) that points to the dict_T.
}
line_breakcheck();
+ if (did_echo_string_emsg) /* recursion error, bail out */
+ break;
}
/* Allocate result buffer with its total size, avoid re-allocation and
if (s != NULL)
ga_concat(&ga, s);
vim_free(tofree);
- if (s == NULL)
+ if (s == NULL || did_echo_string_emsg)
break;
+ line_breakcheck();
+
}
}
if (todo > 0)
if (recurse >= DICT_MAXNEST)
{
- EMSG(_("E724: variable nested too deep for displaying"));
+ if (!did_echo_string_emsg)
+ {
+ /* Only give this message once for a recursive call to avoid
+ * flooding the user with errors. And stop iterating over lists
+ * and dicts. */
+ did_echo_string_emsg = TRUE;
+ EMSG(_("E724: variable nested too deep for displaying"));
+ }
*tofree = NULL;
- return NULL;
+ return (char_u *)"{E724}";
}
++recurse;
*tofree = NULL;
}
- --recurse;
+ if (--recurse == 0)
+ did_echo_string_emsg = FALSE;
return r;
}
msg_outnum((long)argvars[i].vval.v_number);
else
{
+ /* Do not want errors such as E724 here. */
+ ++emsg_off;
s = tv2string(&argvars[i], &tofree, numbuf2, 0);
+ --emsg_off;
if (s != NULL)
{
if (vim_strsize(s) > MSG_BUF_CLEN)
/* The value may be very long. Skip the middle part, so that we
* have some idea how it starts and ends. smsg() would always
- * truncate it at the end. */
+ * truncate it at the end. Don't want errors such as E724 here. */
+ ++emsg_off;
s = tv2string(fc->rettv, &tofree, numbuf2, 0);
+ --emsg_off;
if (s != NULL)
{
if (vim_strsize(s) > MSG_BUF_CLEN)