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