Skip to content

Commit e51bb17

Browse files
committed
patch 8.2.0267: no check for a following cmd when calling a function fails
Problem: No check for a following command when calling a function fails. Solution: Also check for a following command when inside a try block. (closes #5642)
1 parent a28be85 commit e51bb17

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/testdir/test_user_func.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,7 @@ endfunc
162162
func Test_user_method()
163163
eval 'bar'->s:addFoo()->assert_equal('barfoo')
164164
endfunc
165+
166+
func Test_failed_call_in_try()
167+
try | call UnknownFunc() | catch | endtry
168+
endfunc

src/userfunc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3554,7 +3554,8 @@ ex_call(exarg_T *eap)
35543554
if (eap->skip)
35553555
--emsg_skip;
35563556

3557-
if (!failed)
3557+
// When inside :try we need to check for following "| catch".
3558+
if (!failed || eap->cstack->cs_trylevel > 0)
35583559
{
35593560
// Check for trailing illegal characters and a following command.
35603561
if (!ends_excmd(*arg))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
267,
745747
/**/
746748
266,
747749
/**/

0 commit comments

Comments
 (0)