Skip to content

Commit 4301a72

Browse files
committed
patch 8.2.1421: Vim9: handling "+" and "-" before number differs from script
Problem: Vim9: handling "+" and "-" before number differs from Vim script. Solution: Use the same sequence of commands.
1 parent f7c4d83 commit 4301a72

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/version.c

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

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1421,
757759
/**/
758760
1420,
759761
/**/

src/vim9compile.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3206,6 +3206,15 @@ compile_expr7(
32063206
case '9':
32073207
case '.': if (eval_number(arg, rettv, TRUE, FALSE) == FAIL)
32083208
return FAIL;
3209+
// Apply "-" and "+" just before the number now, right to
3210+
// left. Matters especially when "->" follows. Stops at
3211+
// '!'.
3212+
if (apply_leader(rettv, TRUE,
3213+
start_leader, &end_leader) == FAIL)
3214+
{
3215+
clear_tv(rettv);
3216+
return FAIL;
3217+
}
32093218
break;
32103219

32113220
/*
@@ -3344,13 +3353,6 @@ compile_expr7(
33443353

33453354
if (rettv->v_type != VAR_UNKNOWN && used_before == ppconst->pp_used)
33463355
{
3347-
// apply the '-' and '+' before the constant, but not '!'
3348-
if (apply_leader(rettv, TRUE, start_leader, &end_leader) == FAIL)
3349-
{
3350-
clear_tv(rettv);
3351-
return FAIL;
3352-
}
3353-
33543356
if (cctx->ctx_skip == SKIP_YES)
33553357
clear_tv(rettv);
33563358
else

0 commit comments

Comments
 (0)