diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-11-28 20:38:37 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-11-28 20:38:37 +0100 |
commit | 76a6345433bc2a600689397fb28165a2e5793720 (patch) | |
tree | 445a832b355fa2803004a1de2d1f1b6276f56305 /src | |
parent | 10efcd5b0259659cd9a152a7a342deb5d56a8eb5 (diff) |
patch 8.1.0550: expression evaluation may repeat an error messagev8.1.0550
Problem: Expression evaluation may repeat an error message. (Jason
Franklin)
Solution: Increment did_emsg and check for the value when giving an error
for the echo command.
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 3 | ||||
-rw-r--r-- | src/message.c | 4 | ||||
-rw-r--r-- | src/testdir/test108.ok | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/src/eval.c b/src/eval.c index 4a3cf99124..a525678354 100644 --- a/src/eval.c +++ b/src/eval.c @@ -7999,6 +7999,7 @@ ex_echo(exarg_T *eap) int needclr = TRUE; int atstart = TRUE; char_u numbuf[NUMBUFLEN]; + int did_emsg_before = did_emsg; if (eap->skip) ++emsg_skip; @@ -8016,7 +8017,7 @@ ex_echo(exarg_T *eap) * 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; break; diff --git a/src/message.c b/src/message.c index c2318bd8af..5a990ff604 100644 --- a/src/message.c +++ b/src/message.c @@ -636,7 +636,7 @@ emsg(char_u *s) if (cause_errthrow(s, severe, &ignore) == TRUE) { if (!ignore) - did_emsg = TRUE; + ++did_emsg; return TRUE; } @@ -689,7 +689,7 @@ emsg(char_u *s) beep_flush(); /* also includes flush_buffers() */ else flush_buffers(FLUSH_MINIMAL); // flush internal buffers - did_emsg = TRUE; // flag for DoOneCmd() + ++did_emsg; // flag for DoOneCmd() #ifdef FEAT_EVAL did_uncaught_emsg = TRUE; #endif diff --git a/src/testdir/test108.ok b/src/testdir/test108.ok index 6315edcc21..7a531dd240 100644 --- a/src/testdir/test108.ok +++ b/src/testdir/test108.ok @@ -28,7 +28,6 @@ undefined var3 on former level: 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 @@ -36,7 +35,6 @@ undefined var2 on former level 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 diff --git a/src/version.c b/src/version.c index 1fb70f8826..d8d66f0ef0 100644 --- a/src/version.c +++ b/src/version.c @@ -793,6 +793,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 550, +/**/ 549, /**/ 548, |