mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
vim-patch:7.4.327 #1010
Problem: When 'verbose' is set to display the return value of a function, may get E724 repeatedly. Solution: Do not give an error for verbose messages. Abort conversion to string after an error. https://code.google.com/p/vim/source/detail?r=99d8f2d72dcd4b850de81998cc9b1120c8165762
This commit is contained in:

committed by
Justin M. Keyes

parent
d730c5c57e
commit
fde390133e
@@ -193,6 +193,9 @@ static int current_copyID = 0;
|
|||||||
#define COPYID_INC 2
|
#define COPYID_INC 2
|
||||||
#define COPYID_MASK (~0x1)
|
#define COPYID_MASK (~0x1)
|
||||||
|
|
||||||
|
/// Abort conversion to string after a recursion error.
|
||||||
|
static bool did_echo_string_emsg = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Array to hold the hashtab with variables local to each sourced script.
|
* Array to hold the hashtab with variables local to each sourced script.
|
||||||
* Each item holds a variable (nameless) that points to the dict_T.
|
* Each item holds a variable (nameless) that points to the dict_T.
|
||||||
@@ -5322,6 +5325,9 @@ list_join_inner (
|
|||||||
}
|
}
|
||||||
|
|
||||||
line_breakcheck();
|
line_breakcheck();
|
||||||
|
if (did_echo_string_emsg) { // recursion error, bail out
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate result buffer with its total size, avoid re-allocation and
|
/* Allocate result buffer with its total size, avoid re-allocation and
|
||||||
@@ -5945,9 +5951,11 @@ static char_u *dict2string(typval_T *tv, int copyID)
|
|||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
ga_concat(&ga, s);
|
ga_concat(&ga, s);
|
||||||
free(tofree);
|
free(tofree);
|
||||||
if (s == NULL)
|
if (s == NULL || did_echo_string_emsg) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
line_breakcheck();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (todo > 0) {
|
if (todo > 0) {
|
||||||
free(ga.ga_data);
|
free(ga.ga_data);
|
||||||
@@ -6077,9 +6085,15 @@ static char_u *echo_string(typval_T *tv, char_u **tofree, char_u *numbuf, int co
|
|||||||
char_u *r = NULL;
|
char_u *r = NULL;
|
||||||
|
|
||||||
if (recurse >= DICT_MAXNEST) {
|
if (recurse >= DICT_MAXNEST) {
|
||||||
|
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"));
|
EMSG(_("E724: variable nested too deep for displaying"));
|
||||||
|
}
|
||||||
*tofree = NULL;
|
*tofree = NULL;
|
||||||
return NULL;
|
return (char_u *)"{E724}";
|
||||||
}
|
}
|
||||||
++recurse;
|
++recurse;
|
||||||
|
|
||||||
@@ -6134,7 +6148,9 @@ static char_u *echo_string(typval_T *tv, char_u **tofree, char_u *numbuf, int co
|
|||||||
*tofree = NULL;
|
*tofree = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
--recurse;
|
if (--recurse == 0) {
|
||||||
|
did_echo_string_emsg = false;
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18009,7 +18025,10 @@ call_user_func (
|
|||||||
if (argvars[i].v_type == VAR_NUMBER)
|
if (argvars[i].v_type == VAR_NUMBER)
|
||||||
msg_outnum((long)argvars[i].vval.v_number);
|
msg_outnum((long)argvars[i].vval.v_number);
|
||||||
else {
|
else {
|
||||||
|
// Do not want errors such as E724 here.
|
||||||
|
++emsg_off;
|
||||||
s = tv2string(&argvars[i], &tofree, numbuf2, 0);
|
s = tv2string(&argvars[i], &tofree, numbuf2, 0);
|
||||||
|
--emsg_off;
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
if (vim_strsize(s) > MSG_BUF_CLEN) {
|
if (vim_strsize(s) > MSG_BUF_CLEN) {
|
||||||
trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN);
|
trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN);
|
||||||
@@ -18091,10 +18110,12 @@ call_user_func (
|
|||||||
char_u *tofree;
|
char_u *tofree;
|
||||||
char_u *s;
|
char_u *s;
|
||||||
|
|
||||||
/* The value may be very long. Skip the middle part, so that we
|
// The value may be very long. Skip the middle part, so that we
|
||||||
* have some idea how it starts and ends. smsg() would always
|
// 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);
|
s = tv2string(fc->rettv, &tofree, numbuf2, 0);
|
||||||
|
--emsg_off;
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
if (vim_strsize(s) > MSG_BUF_CLEN) {
|
if (vim_strsize(s) > MSG_BUF_CLEN) {
|
||||||
trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN);
|
trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN);
|
||||||
|
@@ -222,7 +222,7 @@ static int included_patches[] = {
|
|||||||
//330,
|
//330,
|
||||||
//329,
|
//329,
|
||||||
//328,
|
//328,
|
||||||
//327,
|
327,
|
||||||
//326,
|
//326,
|
||||||
//325,
|
//325,
|
||||||
//324,
|
//324,
|
||||||
|
Reference in New Issue
Block a user