mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
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)
This commit is contained in:
@@ -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
|
||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2013,
|
||||
/**/
|
||||
2012,
|
||||
/**/
|
||||
|
@@ -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 == '-';
|
||||
|
Reference in New Issue
Block a user