summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-11-18 17:39:05 +0100
committerBram Moolenaar <Bram@vim.org>2020-11-18 17:39:05 +0100
commit79cdf80bed3192add70882bc0aaeede91cc74300 (patch)
tree6e07da14c05b1671b046a9c2f06a25d688817138
parentd92cc130fbb1beacf6411ee5837545f46f9be90e (diff)
downloadvim-git-79cdf80bed3192add70882bc0aaeede91cc74300.tar.gz
patch 8.2.2013: Vim9: not skipping white space after unary minusv8.2.2013
Problem: Vim9: not skipping white space after unary minus. Solution: Skip whitespace. (closes #7324)
-rw-r--r--src/testdir/test_vim9_expr.vim21
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c2
3 files changed, 23 insertions, 2 deletions
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index b7897fe7c..156d24462 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -2300,12 +2300,29 @@ def Test_expr7_parens_vim9script()
CheckScriptSuccess(lines)
enddef
-def Test_expr7_negate()
+def Test_expr7_negate_add()
assert_equal(-99, -99)
+ assert_equal(-99, - 99)
assert_equal(99, --99)
+ assert_equal(99, -- 99)
+ assert_equal(99, - - 99)
+ assert_equal(99, +99)
+ assert_equal(-99, -+99)
+ assert_equal(-99, -+ 99)
+ assert_equal(-99, - +99)
+ assert_equal(-99, - + 99)
+ assert_equal(-99, +-99)
+ assert_equal(-99, + -99)
+ assert_equal(-99, + - 99)
+
var nr = 88
assert_equal(-88, -nr)
- assert_equal(88, --nr)
+ assert_equal(-88, - nr)
+ assert_equal(-88, - +nr)
+ assert_equal(88, -- nr)
+ assert_equal(88, + nr)
+ assert_equal(88, --+ nr)
+ assert_equal(88, - - nr)
enddef
def Echo(arg: any): string
diff --git a/src/version.c b/src/version.c
index 0f0ccda25..3f5cd797c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2013,
+/**/
2012,
/**/
2011,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index c5d92aa1b..2c522809d 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3362,6 +3362,8 @@ compile_leader(cctx_T *cctx, int numeric_only, char_u *start, char_u **end)
while (p > start)
{
--p;
+ while (VIM_ISWHITE(*p))
+ --p;
if (*p == '-' || *p == '+')
{
int negate = *p == '-';