3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.229
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.229
3ef2ca
Problem:    Using ":let" for listing variables and the second one is a curly
3ef2ca
	    braces expression may fail.
3ef2ca
Solution:   Check for an "=" in a better way. (ZyX)
3ef2ca
Files:	    src/eval.c, src/testdir/test104.in, src/testdir/test104.ok
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.228/src/eval.c	2014-03-25 18:23:27.062087691 +0100
3ef2ca
--- src/eval.c	2014-03-30 16:46:24.464562806 +0200
3ef2ca
***************
3ef2ca
*** 1856,1863 ****
3ef2ca
  	return;
3ef2ca
      if (argend > arg && argend[-1] == '.')  /* for var.='str' */
3ef2ca
  	--argend;
3ef2ca
!     expr = vim_strchr(argend, '=');
3ef2ca
!     if (expr == NULL)
3ef2ca
      {
3ef2ca
  	/*
3ef2ca
  	 * ":let" without "=": list variables
3ef2ca
--- 1856,1864 ----
3ef2ca
  	return;
3ef2ca
      if (argend > arg && argend[-1] == '.')  /* for var.='str' */
3ef2ca
  	--argend;
3ef2ca
!     expr = skipwhite(argend);
3ef2ca
!     if (*expr != '=' && !(vim_strchr((char_u *)"+-.", *expr) != NULL
3ef2ca
! 			  && expr[1] == '='))
3ef2ca
      {
3ef2ca
  	/*
3ef2ca
  	 * ":let" without "=": list variables
3ef2ca
***************
3ef2ca
*** 1886,1897 ****
3ef2ca
      {
3ef2ca
  	op[0] = '=';
3ef2ca
  	op[1] = NUL;
3ef2ca
! 	if (expr > argend)
3ef2ca
  	{
3ef2ca
! 	    if (vim_strchr((char_u *)"+-.", expr[-1]) != NULL)
3ef2ca
! 		op[0] = expr[-1];   /* +=, -= or .= */
3ef2ca
  	}
3ef2ca
! 	expr = skipwhite(expr + 1);
3ef2ca
  
3ef2ca
  	if (eap->skip)
3ef2ca
  	    ++emsg_skip;
3ef2ca
--- 1887,1900 ----
3ef2ca
      {
3ef2ca
  	op[0] = '=';
3ef2ca
  	op[1] = NUL;
3ef2ca
! 	if (*expr != '=')
3ef2ca
  	{
3ef2ca
! 	    if (vim_strchr((char_u *)"+-.", *expr) != NULL)
3ef2ca
! 		op[0] = *expr;   /* +=, -= or .= */
3ef2ca
! 	    expr = skipwhite(expr + 2);
3ef2ca
  	}
3ef2ca
! 	else
3ef2ca
! 	    expr = skipwhite(expr + 1);
3ef2ca
  
3ef2ca
  	if (eap->skip)
3ef2ca
  	    ++emsg_skip;
3ef2ca
*** ../vim-7.4.228/src/testdir/test104.in	2014-02-05 22:25:29.982568243 +0100
3ef2ca
--- src/testdir/test104.in	2014-03-30 16:44:39.432561197 +0200
3ef2ca
***************
3ef2ca
*** 1,4 ****
3ef2ca
! Tests for autoload.  vim: set ft=vim ts=8 :
3ef2ca
  
3ef2ca
  STARTTEST
3ef2ca
  :so small.vim
3ef2ca
--- 1,4 ----
3ef2ca
! Tests for :let.  vim: set ft=vim ts=8 :
3ef2ca
  
3ef2ca
  STARTTEST
3ef2ca
  :so small.vim
3ef2ca
***************
3ef2ca
*** 10,15 ****
3ef2ca
--- 10,29 ----
3ef2ca
  :catch
3ef2ca
  :  $put ='FAIL: ' . v:exception
3ef2ca
  :endtry
3ef2ca
+ :let a = 1
3ef2ca
+ :let b = 2
3ef2ca
+ :for letargs in ['a b', '{0 == 1 ? "a" : "b"}', '{0 == 1 ? "a" : "b"} a', 'a {0 == 1 ? "a" : "b"}']
3ef2ca
+ :  try
3ef2ca
+ :    redir => messages
3ef2ca
+ :    execute 'let' letargs
3ef2ca
+ :    redir END
3ef2ca
+ :    $put ='OK:'
3ef2ca
+ :    $put =split(substitute(messages, '\n', '\0  ', 'g'), '\n')
3ef2ca
+ :  catch
3ef2ca
+ :    $put ='FAIL: ' . v:exception
3ef2ca
+ :    redir END
3ef2ca
+ :  endtry
3ef2ca
+ :endfor
3ef2ca
  :/^Results/,$wq! test.out
3ef2ca
  ENDTEST
3ef2ca
  
3ef2ca
*** ../vim-7.4.228/src/testdir/test104.ok	2014-02-05 22:25:29.982568243 +0100
3ef2ca
--- src/testdir/test104.ok	2014-03-30 16:44:39.432561197 +0200
3ef2ca
***************
3ef2ca
*** 1,2 ****
3ef2ca
--- 1,13 ----
3ef2ca
  Results of test104:
3ef2ca
  OK: function('tr')
3ef2ca
+ OK:
3ef2ca
+   a                     #1
3ef2ca
+   b                     #2
3ef2ca
+ OK:
3ef2ca
+   b                     #2
3ef2ca
+ OK:
3ef2ca
+   b                     #2
3ef2ca
+   a                     #1
3ef2ca
+ OK:
3ef2ca
+   a                     #1
3ef2ca
+   b                     #2
3ef2ca
*** ../vim-7.4.228/src/version.c	2014-03-30 16:11:37.180530823 +0200
3ef2ca
--- src/version.c	2014-03-30 16:46:39.660563039 +0200
3ef2ca
***************
3ef2ca
*** 736,737 ****
3ef2ca
--- 736,739 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     229,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
You have heard the saying that if you put a thousand monkeys in a room with a
3ef2ca
thousand typewriters and waited long enough, eventually you would have a room
3ef2ca
full of dead monkeys.
3ef2ca
				(Scott Adams - The Dilbert principle)
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///