From aa5f3a7962c3b96d1a939a83bf2dacad72d8e898 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 5 May 2023 20:47:57 +0800 Subject: vim-patch:8.2.2094: when an expression fails getting next command may be wrong Problem: When an expression fails getting the next command may be wrong. Solution: Do not check for a next command after :eval fails. (closes vim/vim#7415) https://github.com/vim/vim/commit/d0fe620cbbf5f5e00446efa89893036265c5c302 Co-authored-by: Bram Moolenaar --- src/nvim/eval.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 07f65bbf22..c6a6ef6848 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2367,7 +2367,10 @@ int eval0(char *arg, typval_T *rettv, exarg_T *eap, evalarg_T *const evalarg) semsg(_(e_invexpr2), arg); } } - ret = FAIL; + + // Some of the expression may not have been consumed. Do not check for + // a next command to avoid more errors. + return FAIL; } if (eap != NULL) { -- cgit From ad7f9a701cf25f598cb8ee3d05ad0604fa9a9a65 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 5 May 2023 20:48:25 +0800 Subject: vim-patch:8.2.2141: a user command with try/catch may not catch an expression error Problem: A user command with try/catch may not catch an expression error. Solution: When an expression fails check for following "|". (closes vim/vim#7469) https://github.com/vim/vim/commit/8143a53c533bc7776c57e5db063d185bdd5750f3 Co-authored-by: Bram Moolenaar --- src/nvim/eval.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index c6a6ef6848..f638b90caa 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2369,7 +2369,11 @@ 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. + // 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); + } return FAIL; } -- cgit From 6b912dec8ef06535b164b0f4eb3d55775eb9f6a8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 6 May 2023 07:44:34 +0800 Subject: 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 --- src/nvim/eval.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') 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; } -- cgit