aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval.c8
-rw-r--r--src/nvim/message.c4
2 files changed, 7 insertions, 5 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index a115e60c7d..5d2bdc210b 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -19538,6 +19538,7 @@ void ex_echo(exarg_T *eap)
typval_T rettv;
bool needclr = true;
bool atstart = true;
+ const int did_emsg_before = did_emsg;
if (eap->skip)
++emsg_skip;
@@ -19552,7 +19553,7 @@ void ex_echo(exarg_T *eap)
// Report the invalid expression unless the expression evaluation
// has been cancelled due to an aborting error, an interrupt, or an
// exception.
- if (!aborting()) {
+ if (!aborting() && did_emsg == did_emsg_before) {
EMSG2(_(e_invexpr2), p);
}
need_clr_eos = false;
@@ -19641,7 +19642,7 @@ void ex_execute(exarg_T *eap)
int ret = OK;
char_u *p;
garray_T ga;
- int save_did_emsg;
+ int save_did_emsg = did_emsg;
ga_init(&ga, 1, 80);
@@ -19655,8 +19656,9 @@ void ex_execute(exarg_T *eap)
* has been cancelled due to an aborting error, an interrupt, or an
* exception.
*/
- if (!aborting())
+ if (!aborting() && did_emsg == save_did_emsg) {
EMSG2(_(e_invexpr2), p);
+ }
ret = FAIL;
break;
}
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 26fa8fc7f1..6de81a8aaf 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -505,7 +505,7 @@ int emsg(const char_u *s_)
*/
if (cause_errthrow((char_u *)s, severe, &ignore) == true) {
if (!ignore) {
- did_emsg = true;
+ did_emsg++;
}
return true;
}
@@ -554,7 +554,7 @@ int emsg(const char_u *s_)
} else {
flush_buffers(FLUSH_MINIMAL); // flush internal buffers
}
- did_emsg = true; // flag for DoOneCmd()
+ did_emsg++; // flag for DoOneCmd()
}
emsg_on_display = true; // remember there is an error message