summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/eval.c15
-rw-r--r--src/testdir/test104.in16
-rw-r--r--src/testdir/test104.ok11
-rw-r--r--src/version.c2
4 files changed, 37 insertions, 7 deletions
diff --git a/src/eval.c b/src/eval.c
index baaa12f01..d9785c4a1 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1856,8 +1856,9 @@ ex_let(eap)
return;
if (argend > arg && argend[-1] == '.') /* for var.='str' */
--argend;
- expr = vim_strchr(argend, '=');
- if (expr == NULL)
+ expr = skipwhite(argend);
+ if (*expr != '=' && !(vim_strchr((char_u *)"+-.", *expr) != NULL
+ && expr[1] == '='))
{
/*
* ":let" without "=": list variables
@@ -1886,12 +1887,14 @@ ex_let(eap)
{
op[0] = '=';
op[1] = NUL;
- if (expr > argend)
+ if (*expr != '=')
{
- if (vim_strchr((char_u *)"+-.", expr[-1]) != NULL)
- op[0] = expr[-1]; /* +=, -= or .= */
+ if (vim_strchr((char_u *)"+-.", *expr) != NULL)
+ op[0] = *expr; /* +=, -= or .= */
+ expr = skipwhite(expr + 2);
}
- expr = skipwhite(expr + 1);
+ else
+ expr = skipwhite(expr + 1);
if (eap->skip)
++emsg_skip;
diff --git a/src/testdir/test104.in b/src/testdir/test104.in
index f329d2dbe..fd847131e 100644
--- a/src/testdir/test104.in
+++ b/src/testdir/test104.in
@@ -1,4 +1,4 @@
-Tests for autoload. vim: set ft=vim ts=8 :
+Tests for :let. vim: set ft=vim ts=8 :
STARTTEST
:so small.vim
@@ -10,6 +10,20 @@ STARTTEST
:catch
: $put ='FAIL: ' . v:exception
:endtry
+:let a = 1
+:let b = 2
+:for letargs in ['a b', '{0 == 1 ? "a" : "b"}', '{0 == 1 ? "a" : "b"} a', 'a {0 == 1 ? "a" : "b"}']
+: try
+: redir => messages
+: execute 'let' letargs
+: redir END
+: $put ='OK:'
+: $put =split(substitute(messages, '\n', '\0 ', 'g'), '\n')
+: catch
+: $put ='FAIL: ' . v:exception
+: redir END
+: endtry
+:endfor
:/^Results/,$wq! test.out
ENDTEST
diff --git a/src/testdir/test104.ok b/src/testdir/test104.ok
index 5c16509af..5fb20945c 100644
--- a/src/testdir/test104.ok
+++ b/src/testdir/test104.ok
@@ -1,2 +1,13 @@
Results of test104:
OK: function('tr')
+OK:
+ a #1
+ b #2
+OK:
+ b #2
+OK:
+ b #2
+ a #1
+OK:
+ a #1
+ b #2
diff --git a/src/version.c b/src/version.c
index 1c78a5e47..2f4c89609 100644
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 229,
+/**/
228,
/**/
227,