Blame SOURCES/7.4.229

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