diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-06 07:44:34 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-05-06 07:47:43 +0800 |
commit | 6b912dec8ef06535b164b0f4eb3d55775eb9f6a8 (patch) | |
tree | e87e2da65fd5ea42a537d806c26dd7b15333b40d /src/nvim/eval.c | |
parent | ad7f9a701cf25f598cb8ee3d05ad0604fa9a9a65 (diff) | |
download | rneovim-6b912dec8ef06535b164b0f4eb3d55775eb9f6a8.tar.gz rneovim-6b912dec8ef06535b164b0f4eb3d55775eb9f6a8.tar.bz2 rneovim-6b912dec8ef06535b164b0f4eb3d55775eb9f6a8.zip |
vim-patch:9.0.1508: catch does not work when lines are joined with a newline
Problem: Catch does not work when lines are joined with a newline.
Solution: Set "nextcmd" appropriately. (closes vim/vim#12348)
https://github.com/vim/vim/commit/f2588b6fc90ba85b333ee8f747e8d1ebbc7e6300
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index f638b90caa..42e53cfdfc 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2368,11 +2368,14 @@ int eval0(char *arg, typval_T *rettv, exarg_T *eap, evalarg_T *const evalarg) } } - // 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 && 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 *nextcmd = check_nextcmd(p); + if (nextcmd != NULL && *nextcmd != '|') { + eap->nextcmd = nextcmd; + } } return FAIL; } |