Karsten Hopp 1c56f4
To: vim_dev@googlegroups.com
Karsten Hopp 1c56f4
Subject: Patch 7.4.891
Karsten Hopp 1c56f4
Fcc: outbox
Karsten Hopp 1c56f4
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 1c56f4
Mime-Version: 1.0
Karsten Hopp 1c56f4
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 1c56f4
Content-Transfer-Encoding: 8bit
Karsten Hopp 1c56f4
------------
Karsten Hopp 1c56f4
Karsten Hopp 1c56f4
Patch 7.4.891
Karsten Hopp 1c56f4
Problem:    Indentation of array initializer is wrong.
Karsten Hopp 1c56f4
Solution:   Avoid that calling find_start_rawstring() changes the position
Karsten Hopp 1c56f4
            returned by find_start_comment(), add a test. (Hirohito Higashi)
Karsten Hopp 1c56f4
Files:      src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok
Karsten Hopp 1c56f4
Karsten Hopp 1c56f4
Karsten Hopp 1c56f4
*** ../vim-7.4.890/src/misc1.c	2015-09-15 19:05:49.250365080 +0200
Karsten Hopp 1c56f4
--- src/misc1.c	2015-10-07 11:36:05.441677658 +0200
Karsten Hopp 1c56f4
***************
Karsten Hopp 1c56f4
*** 5345,5352 ****
Karsten Hopp 1c56f4
      static pos_T *
Karsten Hopp 1c56f4
  ind_find_start_CORS()	    /* XXX */
Karsten Hopp 1c56f4
  {
Karsten Hopp 1c56f4
!     pos_T	*comment_pos = find_start_comment(curbuf->b_ind_maxcomment);
Karsten Hopp 1c56f4
!     pos_T	*rs_pos = find_start_rawstring(curbuf->b_ind_maxcomment);
Karsten Hopp 1c56f4
  
Karsten Hopp 1c56f4
      /* If comment_pos is before rs_pos the raw string is inside the comment.
Karsten Hopp 1c56f4
       * If rs_pos is before comment_pos the comment is inside the raw string. */
Karsten Hopp 1c56f4
--- 5345,5363 ----
Karsten Hopp 1c56f4
      static pos_T *
Karsten Hopp 1c56f4
  ind_find_start_CORS()	    /* XXX */
Karsten Hopp 1c56f4
  {
Karsten Hopp 1c56f4
!     static pos_T comment_pos_copy;
Karsten Hopp 1c56f4
!     pos_T	*comment_pos;
Karsten Hopp 1c56f4
!     pos_T	*rs_pos;
Karsten Hopp 1c56f4
! 
Karsten Hopp 1c56f4
!     comment_pos = find_start_comment(curbuf->b_ind_maxcomment);
Karsten Hopp 1c56f4
!     if (comment_pos != NULL)
Karsten Hopp 1c56f4
!     {
Karsten Hopp 1c56f4
! 	/* Need to make a copy of the static pos in findmatchlimit(),
Karsten Hopp 1c56f4
! 	 * calling find_start_rawstring() may change it. */
Karsten Hopp 1c56f4
! 	comment_pos_copy = *comment_pos;
Karsten Hopp 1c56f4
! 	comment_pos = &comment_pos_copy;
Karsten Hopp 1c56f4
!     }
Karsten Hopp 1c56f4
!     rs_pos = find_start_rawstring(curbuf->b_ind_maxcomment);
Karsten Hopp 1c56f4
  
Karsten Hopp 1c56f4
      /* If comment_pos is before rs_pos the raw string is inside the comment.
Karsten Hopp 1c56f4
       * If rs_pos is before comment_pos the comment is inside the raw string. */
Karsten Hopp 1c56f4
***************
Karsten Hopp 1c56f4
*** 8334,8340 ****
Karsten Hopp 1c56f4
  		if (terminated == 0 || (lookfor != LOOKFOR_UNTERM
Karsten Hopp 1c56f4
  							&& terminated == ','))
Karsten Hopp 1c56f4
  		{
Karsten Hopp 1c56f4
! 		    if (*skipwhite(l) == '[' || l[STRLEN(l) - 1] == '[')
Karsten Hopp 1c56f4
  			amount += ind_continuation;
Karsten Hopp 1c56f4
  		    /*
Karsten Hopp 1c56f4
  		     * if we're in the middle of a paren thing,
Karsten Hopp 1c56f4
--- 8345,8352 ----
Karsten Hopp 1c56f4
  		if (terminated == 0 || (lookfor != LOOKFOR_UNTERM
Karsten Hopp 1c56f4
  							&& terminated == ','))
Karsten Hopp 1c56f4
  		{
Karsten Hopp 1c56f4
! 		    if (lookfor != LOOKFOR_ENUM_OR_INIT &&
Karsten Hopp 1c56f4
! 			    (*skipwhite(l) == '[' || l[STRLEN(l) - 1] == '['))
Karsten Hopp 1c56f4
  			amount += ind_continuation;
Karsten Hopp 1c56f4
  		    /*
Karsten Hopp 1c56f4
  		     * if we're in the middle of a paren thing,
Karsten Hopp 1c56f4
***************
Karsten Hopp 1c56f4
*** 8576,8582 ****
Karsten Hopp 1c56f4
  			     */
Karsten Hopp 1c56f4
  			    l = ml_get_curline();
Karsten Hopp 1c56f4
  			    amount = cur_amount;
Karsten Hopp 1c56f4
! 			    if (*skipwhite(l) == ']' || l[STRLEN(l) - 1] == ']')
Karsten Hopp 1c56f4
  				break;
Karsten Hopp 1c56f4
  
Karsten Hopp 1c56f4
  			    /*
Karsten Hopp 1c56f4
--- 8588,8597 ----
Karsten Hopp 1c56f4
  			     */
Karsten Hopp 1c56f4
  			    l = ml_get_curline();
Karsten Hopp 1c56f4
  			    amount = cur_amount;
Karsten Hopp 1c56f4
! 
Karsten Hopp 1c56f4
! 			    n = (int)STRLEN(l);
Karsten Hopp 1c56f4
! 			    if (terminated == ',' && (*skipwhite(l) == ']'
Karsten Hopp 1c56f4
! 					|| (n >=2 && l[n - 2] == ']')))
Karsten Hopp 1c56f4
  				break;
Karsten Hopp 1c56f4
  
Karsten Hopp 1c56f4
  			    /*
Karsten Hopp 1c56f4
*** ../vim-7.4.890/src/testdir/test3.in	2015-07-28 21:17:31.526069349 +0200
Karsten Hopp 1c56f4
--- src/testdir/test3.in	2015-10-07 11:02:39.058670265 +0200
Karsten Hopp 1c56f4
***************
Karsten Hopp 1c56f4
*** 910,915 ****
Karsten Hopp 1c56f4
--- 910,937 ----
Karsten Hopp 1c56f4
      )foo";
Karsten Hopp 1c56f4
       }
Karsten Hopp 1c56f4
  
Karsten Hopp 1c56f4
+ {
Karsten Hopp 1c56f4
+ int a[4] = {
Karsten Hopp 1c56f4
+ [0] = 0,
Karsten Hopp 1c56f4
+ [1] = 1,
Karsten Hopp 1c56f4
+ [2] = 2,
Karsten Hopp 1c56f4
+ [3] = 3,
Karsten Hopp 1c56f4
+ };
Karsten Hopp 1c56f4
+ }
Karsten Hopp 1c56f4
+ 
Karsten Hopp 1c56f4
+ {
Karsten Hopp 1c56f4
+ a = b[2]
Karsten Hopp 1c56f4
+ + 3;
Karsten Hopp 1c56f4
+ }
Karsten Hopp 1c56f4
+ 
Karsten Hopp 1c56f4
+ {
Karsten Hopp 1c56f4
+ if (1)
Karsten Hopp 1c56f4
+ /* aaaaa
Karsten Hopp 1c56f4
+ * bbbbb
Karsten Hopp 1c56f4
+ */
Karsten Hopp 1c56f4
+ a = 1;
Karsten Hopp 1c56f4
+ }
Karsten Hopp 1c56f4
+ 
Karsten Hopp 1c56f4
  /* end of AUTO */
Karsten Hopp 1c56f4
  
Karsten Hopp 1c56f4
  STARTTEST
Karsten Hopp 1c56f4
*** ../vim-7.4.890/src/testdir/test3.ok	2015-07-28 21:17:31.526069349 +0200
Karsten Hopp 1c56f4
--- src/testdir/test3.ok	2015-10-07 11:02:39.058670265 +0200
Karsten Hopp 1c56f4
***************
Karsten Hopp 1c56f4
*** 898,903 ****
Karsten Hopp 1c56f4
--- 898,925 ----
Karsten Hopp 1c56f4
      )foo";
Karsten Hopp 1c56f4
  }
Karsten Hopp 1c56f4
  
Karsten Hopp 1c56f4
+ {
Karsten Hopp 1c56f4
+ 	int a[4] = {
Karsten Hopp 1c56f4
+ 		[0] = 0,
Karsten Hopp 1c56f4
+ 		[1] = 1,
Karsten Hopp 1c56f4
+ 		[2] = 2,
Karsten Hopp 1c56f4
+ 		[3] = 3,
Karsten Hopp 1c56f4
+ 	};
Karsten Hopp 1c56f4
+ }
Karsten Hopp 1c56f4
+ 
Karsten Hopp 1c56f4
+ {
Karsten Hopp 1c56f4
+ 	a = b[2]
Karsten Hopp 1c56f4
+ 		+ 3;
Karsten Hopp 1c56f4
+ }
Karsten Hopp 1c56f4
+ 
Karsten Hopp 1c56f4
+ {
Karsten Hopp 1c56f4
+ 	if (1)
Karsten Hopp 1c56f4
+ 		/* aaaaa
Karsten Hopp 1c56f4
+ 		 * bbbbb
Karsten Hopp 1c56f4
+ 		 */
Karsten Hopp 1c56f4
+ 		a = 1;
Karsten Hopp 1c56f4
+ }
Karsten Hopp 1c56f4
+ 
Karsten Hopp 1c56f4
  /* end of AUTO */
Karsten Hopp 1c56f4
  
Karsten Hopp 1c56f4
  
Karsten Hopp 1c56f4
*** ../vim-7.4.890/src/version.c	2015-10-07 10:39:49.572914770 +0200
Karsten Hopp 1c56f4
--- src/version.c	2015-10-07 11:02:31.614748215 +0200
Karsten Hopp 1c56f4
***************
Karsten Hopp 1c56f4
*** 743,744 ****
Karsten Hopp 1c56f4
--- 743,746 ----
Karsten Hopp 1c56f4
  {   /* Add new patch number below this line */
Karsten Hopp 1c56f4
+ /**/
Karsten Hopp 1c56f4
+     891,
Karsten Hopp 1c56f4
  /**/
Karsten Hopp 1c56f4
Karsten Hopp 1c56f4
-- 
Karsten Hopp 1c56f4
Now it is such a bizarrely improbable coincidence that anything as
Karsten Hopp 1c56f4
mind-bogglingly useful as the Babel fish could have evolved purely by chance
Karsten Hopp 1c56f4
that some thinkers have chosen to see it as a final and clinching proof of the
Karsten Hopp 1c56f4
NON-existence of God.
Karsten Hopp 1c56f4
The argument goes something like this: 'I refuse to prove that I exist,' says
Karsten Hopp 1c56f4
God, 'for proof denies faith, and without faith I am nothing.'
Karsten Hopp 1c56f4
'But,' says Man, 'the Babel fish is a dead giveaway, isn't it?  It could not
Karsten Hopp 1c56f4
have evolved by chance.  It proves you exist, and so therefore, by your own
Karsten Hopp 1c56f4
arguments, you don't.  QED.'
Karsten Hopp 1c56f4
'Oh dear,' says God, 'I hadn't thought of that,' and promptly vanishes in a
Karsten Hopp 1c56f4
puff of logic.
Karsten Hopp 1c56f4
'Oh, that was easy,' says Man, and for an encore goes on to prove that black
Karsten Hopp 1c56f4
is white and gets himself killed on the next pedestrian crossing.
Karsten Hopp 1c56f4
		-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
Karsten Hopp 1c56f4
Karsten Hopp 1c56f4
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 1c56f4
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 1c56f4
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 1c56f4
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///