summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-05 17:22:35 +0100
committerBram Moolenaar <Bram@vim.org>2023-05-05 17:22:35 +0100
commitf2588b6fc90ba85b333ee8f747e8d1ebbc7e6300 (patch)
tree142e00651437bdb74363840e61ac0bb7865dcfa3 /src/eval.c
parent53f5e51628b56ef9171671cd6e9970374036a084 (diff)
patch 9.0.1508: catch does not work when lines are joined with a newlinev9.0.1508
Problem: Catch does not work when lines are joined with a newline. Solution: Set "nextcmd" appropriately. (closes #12348)
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/eval.c b/src/eval.c
index c31b0be072..bae7280795 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2699,12 +2699,15 @@ eval0_retarg(
semsg(_(e_invalid_expression_str), arg);
}
- // Some of the expression may not have been consumed. Do not check for
- // a next command to avoid more errors, unless "|" is following, which
- // could only be a command separator.
- if (eap != NULL && p != NULL
- && skipwhite(p)[0] == '|' && skipwhite(p)[1] != '|')
- eap->nextcmd = check_nextcmd(p);
+ if (eap != NULL && p != NULL)
+ {
+ // Some of the expression may not have been consumed.
+ // Only execute a next command if it cannot be a "||" operator.
+ // The next command may be "catch".
+ char_u *nextcmd = check_nextcmd(p);
+ if (nextcmd != NULL && *nextcmd != '|')
+ eap->nextcmd = nextcmd;
+ }
return FAIL;
}