aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-13 07:17:57 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-11-13 07:21:22 +0800
commit2cb0860117623368bc53e4d578695136ce6912e0 (patch)
tree19c5e1dad0f73c59392c1d97518b8d4267458b3b
parent47ad4c8701b4233aa302c1c21ff08a5f223596c7 (diff)
downloadrneovim-2cb0860117623368bc53e4d578695136ce6912e0.tar.gz
rneovim-2cb0860117623368bc53e4d578695136ce6912e0.tar.bz2
rneovim-2cb0860117623368bc53e4d578695136ce6912e0.zip
vim-patch:8.2.4675: no error for missing expression after :elseif
Problem: No error for missing expression after :elseif. (Ernie Rael) Solution: Check for missing expression. (closes vim/vim#10068) https://github.com/vim/vim/commit/fa010cdfb115fd2f6bae7ea6f6e63be906b5e347 Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r--src/nvim/ex_eval.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 8c2ac895cb..7ffd7bad7f 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -899,7 +899,13 @@ 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".
+ if (skip && 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