lkundrak / rpms / vim

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