aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_eval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-13 08:09:21 +0800
committerGitHub <noreply@github.com>2022-11-13 08:09:21 +0800
commitf516a9ced7238dbb9a3eff453736702fc3d9ec82 (patch)
tree8da04d6c08300f6b09d944378cd15814af61d533 /src/nvim/ex_eval.c
parent47ad4c8701b4233aa302c1c21ff08a5f223596c7 (diff)
parentb25197258086faa94ddfaa2a74e1d0eb3695d9b3 (diff)
downloadrneovim-f516a9ced7238dbb9a3eff453736702fc3d9ec82.tar.gz
rneovim-f516a9ced7238dbb9a3eff453736702fc3d9ec82.tar.bz2
rneovim-f516a9ced7238dbb9a3eff453736702fc3d9ec82.zip
Merge pull request #21037 from zeertzjq/vim-8.2.4675
vim-patch:8.2.{4675,4676},9.0.0869: no error for missing expression after :elseif
Diffstat (limited to 'src/nvim/ex_eval.c')
-rw-r--r--src/nvim/ex_eval.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 8c2ac895cb..bde2f3c801 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -899,7 +899,14 @@ void ex_else(exarg_T *eap)
if (eap->cmdidx == CMD_elseif) {
bool error;
- result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
+ // When skipping we ignore most errors, but a missing expression is
+ // wrong, perhaps it should have been "else".
+ // A double quote here is the start of a string, not a comment.
+ if (skip && *eap->arg != '"' && ends_excmd(*eap->arg)) {
+ semsg(_(e_invexpr2), eap->arg);
+ } else {
+ result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
+ }
// When throwing error exceptions, we want to throw always the first
// of several errors in a row. This is what actually happens when