Karsten Hopp fd94ce
To: vim_dev@googlegroups.com
Karsten Hopp fd94ce
Subject: Patch 7.4.350
Karsten Hopp fd94ce
Fcc: outbox
Karsten Hopp fd94ce
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp fd94ce
Mime-Version: 1.0
Karsten Hopp fd94ce
Content-Type: text/plain; charset=UTF-8
Karsten Hopp fd94ce
Content-Transfer-Encoding: 8bit
Karsten Hopp fd94ce
------------
Karsten Hopp fd94ce
Karsten Hopp fd94ce
Patch 7.4.350
Karsten Hopp fd94ce
Problem:    Using C indenting for Javascript does not work well for a {} block
Karsten Hopp fd94ce
	    inside parenthesis.
Karsten Hopp fd94ce
Solution:   When looking for a matching paren ignore one that is before the
Karsten Hopp fd94ce
	    start of a {} block.
Karsten Hopp fd94ce
Files:	    src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok
Karsten Hopp fd94ce
Karsten Hopp fd94ce
Karsten Hopp fd94ce
*** ../vim-7.4.349/src/misc1.c	2014-07-02 17:02:29.722212319 +0200
Karsten Hopp fd94ce
--- src/misc1.c	2014-07-02 18:09:39.670274070 +0200
Karsten Hopp fd94ce
***************
Karsten Hopp fd94ce
*** 6614,6620 ****
Karsten Hopp fd94ce
  }
Karsten Hopp fd94ce
  
Karsten Hopp fd94ce
  /*
Karsten Hopp fd94ce
!  * Find the matching '(', failing if it is in a comment.
Karsten Hopp fd94ce
   * Return NULL if no match found.
Karsten Hopp fd94ce
   */
Karsten Hopp fd94ce
      static pos_T *
Karsten Hopp fd94ce
--- 6614,6620 ----
Karsten Hopp fd94ce
  }
Karsten Hopp fd94ce
  
Karsten Hopp fd94ce
  /*
Karsten Hopp fd94ce
!  * Find the matching '(', ignoring it if it is in a comment.
Karsten Hopp fd94ce
   * Return NULL if no match found.
Karsten Hopp fd94ce
   */
Karsten Hopp fd94ce
      static pos_T *
Karsten Hopp fd94ce
***************
Karsten Hopp fd94ce
*** 6645,6650 ****
Karsten Hopp fd94ce
--- 6645,6676 ----
Karsten Hopp fd94ce
  }
Karsten Hopp fd94ce
  
Karsten Hopp fd94ce
  /*
Karsten Hopp fd94ce
+  * Find the matching '(', ignoring it if it is in a comment or before an
Karsten Hopp fd94ce
+  * unmatched {.
Karsten Hopp fd94ce
+  * Return NULL if no match found.
Karsten Hopp fd94ce
+  */
Karsten Hopp fd94ce
+     static pos_T *
Karsten Hopp fd94ce
+ find_match_paren_after_brace(ind_maxparen)	    /* XXX */
Karsten Hopp fd94ce
+     int		ind_maxparen;
Karsten Hopp fd94ce
+ {
Karsten Hopp fd94ce
+     pos_T	*trypos = find_match_paren(ind_maxparen);
Karsten Hopp fd94ce
+ 
Karsten Hopp fd94ce
+     if (trypos != NULL)
Karsten Hopp fd94ce
+     {
Karsten Hopp fd94ce
+ 	pos_T	*tryposBrace = find_start_brace();
Karsten Hopp fd94ce
+ 
Karsten Hopp fd94ce
+ 	/* If both an unmatched '(' and '{' is found.  Ignore the '('
Karsten Hopp fd94ce
+ 	 * position if the '{' is further down. */
Karsten Hopp fd94ce
+ 	if (tryposBrace != NULL
Karsten Hopp fd94ce
+ 		&& (trypos->lnum != tryposBrace->lnum
Karsten Hopp fd94ce
+ 		    ? trypos->lnum < tryposBrace->lnum
Karsten Hopp fd94ce
+ 		    : trypos->col < tryposBrace->col))
Karsten Hopp fd94ce
+ 	    trypos = NULL;
Karsten Hopp fd94ce
+     }
Karsten Hopp fd94ce
+     return trypos;
Karsten Hopp fd94ce
+ }
Karsten Hopp fd94ce
+ 
Karsten Hopp fd94ce
+ /*
Karsten Hopp fd94ce
   * Return ind_maxparen corrected for the difference in line number between the
Karsten Hopp fd94ce
   * cursor position and "startpos".  This makes sure that searching for a
Karsten Hopp fd94ce
   * matching paren above the cursor line doesn't find a match because of
Karsten Hopp fd94ce
***************
Karsten Hopp fd94ce
*** 7419,7425 ****
Karsten Hopp fd94ce
  		{
Karsten Hopp fd94ce
  		    curwin->w_cursor.lnum = our_paren_pos.lnum;
Karsten Hopp fd94ce
  		    curwin->w_cursor.col = col;
Karsten Hopp fd94ce
! 		    if (find_match_paren(curbuf->b_ind_maxparen) != NULL)
Karsten Hopp fd94ce
  			amount += curbuf->b_ind_unclosed2;
Karsten Hopp fd94ce
  		    else
Karsten Hopp fd94ce
  		    {
Karsten Hopp fd94ce
--- 7445,7452 ----
Karsten Hopp fd94ce
  		{
Karsten Hopp fd94ce
  		    curwin->w_cursor.lnum = our_paren_pos.lnum;
Karsten Hopp fd94ce
  		    curwin->w_cursor.col = col;
Karsten Hopp fd94ce
! 		    if (find_match_paren_after_brace(curbuf->b_ind_maxparen)
Karsten Hopp fd94ce
! 								      != NULL)
Karsten Hopp fd94ce
  			amount += curbuf->b_ind_unclosed2;
Karsten Hopp fd94ce
  		    else
Karsten Hopp fd94ce
  		    {
Karsten Hopp fd94ce
*** ../vim-7.4.349/src/testdir/test3.in	2013-03-07 12:39:35.000000000 +0100
Karsten Hopp fd94ce
--- src/testdir/test3.in	2014-07-02 18:08:06.430272641 +0200
Karsten Hopp fd94ce
***************
Karsten Hopp fd94ce
*** 1950,1955 ****
Karsten Hopp fd94ce
--- 1950,1959 ----
Karsten Hopp fd94ce
  JSSTART
Karsten Hopp fd94ce
  (function($){
Karsten Hopp fd94ce
  
Karsten Hopp fd94ce
+ if (cond &&
Karsten Hopp fd94ce
+ cond) {
Karsten Hopp fd94ce
+ stmt;
Karsten Hopp fd94ce
+ }
Karsten Hopp fd94ce
  var class_name='myclass';
Karsten Hopp fd94ce
  
Karsten Hopp fd94ce
  function private_method() {
Karsten Hopp fd94ce
*** ../vim-7.4.349/src/testdir/test3.ok	2013-03-07 12:40:03.000000000 +0100
Karsten Hopp fd94ce
--- src/testdir/test3.ok	2014-07-02 18:09:14.470273684 +0200
Karsten Hopp fd94ce
***************
Karsten Hopp fd94ce
*** 1728,1733 ****
Karsten Hopp fd94ce
--- 1728,1737 ----
Karsten Hopp fd94ce
  JSSTART
Karsten Hopp fd94ce
  (function($){
Karsten Hopp fd94ce
  
Karsten Hopp fd94ce
+ 	if (cond &&
Karsten Hopp fd94ce
+ 			cond) {
Karsten Hopp fd94ce
+ 		stmt;
Karsten Hopp fd94ce
+ 	}
Karsten Hopp fd94ce
  	var class_name='myclass';
Karsten Hopp fd94ce
  
Karsten Hopp fd94ce
  	function private_method() {
Karsten Hopp fd94ce
*** ../vim-7.4.349/src/version.c	2014-07-02 17:16:51.334225522 +0200
Karsten Hopp fd94ce
--- src/version.c	2014-07-02 18:06:31.330271184 +0200
Karsten Hopp fd94ce
***************
Karsten Hopp fd94ce
*** 736,737 ****
Karsten Hopp fd94ce
--- 736,739 ----
Karsten Hopp fd94ce
  {   /* Add new patch number below this line */
Karsten Hopp fd94ce
+ /**/
Karsten Hopp fd94ce
+     350,
Karsten Hopp fd94ce
  /**/
Karsten Hopp fd94ce
Karsten Hopp fd94ce
-- 
Karsten Hopp fd94ce
FATHER:    You killed eight wedding guests in all!
Karsten Hopp fd94ce
LAUNCELOT: Er, Well ... the thing is ... I thought your son was a lady.
Karsten Hopp fd94ce
FATHER:    I can understand that.
Karsten Hopp fd94ce
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp fd94ce
Karsten Hopp fd94ce
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp fd94ce
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp fd94ce
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp fd94ce
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///