aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval.c3
-rw-r--r--src/nvim/message.c4
-rw-r--r--test/functional/legacy/108_backtrace_debug_commands_spec.lua2
3 files changed, 4 insertions, 5 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index a115e60c7d..3cb0e65701 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;
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 10f4905fb2..37828f7ad3 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
diff --git a/test/functional/legacy/108_backtrace_debug_commands_spec.lua b/test/functional/legacy/108_backtrace_debug_commands_spec.lua
index 9ace4ef093..1c1a2095d5 100644
--- a/test/functional/legacy/108_backtrace_debug_commands_spec.lua
+++ b/test/functional/legacy/108_backtrace_debug_commands_spec.lua
@@ -121,7 +121,6 @@ describe('108', function()
Error detected while processing function Foo[2]..Bar[2]..Bazz:
line 3:
E121: Undefined variable: var3
- E15: Invalid expression: var3
here var3 is defined with "another var":
another var
@@ -129,7 +128,6 @@ describe('108', function()
Error detected while processing function Foo[2]..Bar:
line 3:
E121: Undefined variable: var2
- E15: Invalid expression: var2
here var2 is defined with 10:
10