Skip to content

Commit 79cdf80

Browse files
committed
patch 8.2.2013: Vim9: not skipping white space after unary minus
Problem: Vim9: not skipping white space after unary minus. Solution: Skip whitespace. (closes #7324)
1 parent d92cc13 commit 79cdf80

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

src/testdir/test_vim9_expr.vim

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,12 +2300,29 @@ def Test_expr7_parens_vim9script()
23002300
CheckScriptSuccess(lines)
23012301
enddef
23022302

2303-
def Test_expr7_negate()
2303+
def Test_expr7_negate_add()
23042304
assert_equal(-99, -99)
2305+
assert_equal(-99, - 99)
23052306
assert_equal(99, --99)
2307+
assert_equal(99, -- 99)
2308+
assert_equal(99, - - 99)
2309+
assert_equal(99, +99)
2310+
assert_equal(-99, -+99)
2311+
assert_equal(-99, -+ 99)
2312+
assert_equal(-99, - +99)
2313+
assert_equal(-99, - + 99)
2314+
assert_equal(-99, +-99)
2315+
assert_equal(-99, + -99)
2316+
assert_equal(-99, + - 99)
2317+
23062318
var nr = 88
23072319
assert_equal(-88, -nr)
2308-
assert_equal(88, --nr)
2320+
assert_equal(-88, - nr)
2321+
assert_equal(-88, - +nr)
2322+
assert_equal(88, -- nr)
2323+
assert_equal(88, + nr)
2324+
assert_equal(88, --+ nr)
2325+
assert_equal(88, - - nr)
23092326
enddef
23102327

23112328
def Echo(arg: any): string

src/version.c

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

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2013,
753755
/**/
754756
2012,
755757
/**/

src/vim9compile.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3362,6 +3362,8 @@ compile_leader(cctx_T *cctx, int numeric_only, char_u *start, char_u **end)
33623362
while (p > start)
33633363
{
33643364
--p;
3365+
while (VIM_ISWHITE(*p))
3366+
--p;
33653367
if (*p == '-' || *p == '+')
33663368
{
33673369
int negate = *p == '-';

0 commit comments

Comments
 (0)