Karsten Hopp f409bd
To: vim_dev@googlegroups.com
Karsten Hopp f409bd
Subject: Patch 7.3.332
Karsten Hopp f409bd
Fcc: outbox
Karsten Hopp f409bd
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp f409bd
Mime-Version: 1.0
Karsten Hopp f409bd
Content-Type: text/plain; charset=UTF-8
Karsten Hopp f409bd
Content-Transfer-Encoding: 8bit
Karsten Hopp f409bd
------------
Karsten Hopp f409bd
Karsten Hopp f409bd
Patch 7.3.332 (after 7.3.202)
Karsten Hopp f409bd
Problem:    Indent after "public:" is not increased in C++ code. (Lech Lorens)
Karsten Hopp f409bd
Solution:   Check for namespace after the regular checks. (partly by Martin
Karsten Hopp f409bd
	    Gieseking)
Karsten Hopp f409bd
Files:	    src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok
Karsten Hopp f409bd
Karsten Hopp f409bd
Karsten Hopp f409bd
*** ../vim-7.3.331/src/misc1.c	2011-09-07 19:58:04.000000000 +0200
Karsten Hopp f409bd
--- src/misc1.c	2011-10-04 17:59:52.000000000 +0200
Karsten Hopp f409bd
***************
Karsten Hopp f409bd
*** 6389,6394 ****
Karsten Hopp f409bd
--- 6389,6395 ----
Karsten Hopp f409bd
      int		lookfor_cpp_namespace = FALSE;
Karsten Hopp f409bd
      int		cont_amount = 0;    /* amount for continuation line */
Karsten Hopp f409bd
      int		original_line_islabel;
Karsten Hopp f409bd
+     int		added_to_amount = 0;
Karsten Hopp f409bd
  
Karsten Hopp f409bd
      for (options = curbuf->b_p_cino; *options; )
Karsten Hopp f409bd
      {
Karsten Hopp f409bd
***************
Karsten Hopp f409bd
*** 7216,7267 ****
Karsten Hopp f409bd
  			else
Karsten Hopp f409bd
  			    amount += ind_continuation;
Karsten Hopp f409bd
  		    }
Karsten Hopp f409bd
! 		    else if (lookfor_cpp_namespace)
Karsten Hopp f409bd
  		    {
Karsten Hopp f409bd
! 			if (curwin->w_cursor.lnum == ourscope)
Karsten Hopp f409bd
! 			    continue;
Karsten Hopp f409bd
  
Karsten Hopp f409bd
! 			if (curwin->w_cursor.lnum == 0
Karsten Hopp f409bd
! 				|| curwin->w_cursor.lnum
Karsten Hopp f409bd
  					      < ourscope - FIND_NAMESPACE_LIM)
Karsten Hopp f409bd
! 			    break;
Karsten Hopp f409bd
  
Karsten Hopp f409bd
! 			l = ml_get_curline();
Karsten Hopp f409bd
  
Karsten Hopp f409bd
! 			/*
Karsten Hopp f409bd
! 			 * If we're in a comment now, skip to the start of the
Karsten Hopp f409bd
! 			 * comment.
Karsten Hopp f409bd
! 			 */
Karsten Hopp f409bd
! 			trypos = find_start_comment(ind_maxcomment);
Karsten Hopp f409bd
! 			if (trypos != NULL)
Karsten Hopp f409bd
! 			{
Karsten Hopp f409bd
! 			    curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp f409bd
! 			    curwin->w_cursor.col = 0;
Karsten Hopp f409bd
! 			    continue;
Karsten Hopp f409bd
! 			}
Karsten Hopp f409bd
! 
Karsten Hopp f409bd
! 			/*
Karsten Hopp f409bd
! 			 * Skip preprocessor directives and blank lines.
Karsten Hopp f409bd
! 			 */
Karsten Hopp f409bd
! 			if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum))
Karsten Hopp f409bd
! 			    continue;
Karsten Hopp f409bd
  
Karsten Hopp f409bd
! 			if (cin_is_cpp_namespace(l))
Karsten Hopp f409bd
! 			{
Karsten Hopp f409bd
! 			    amount += ind_cpp_namespace;
Karsten Hopp f409bd
! 			    break;
Karsten Hopp f409bd
! 			}
Karsten Hopp f409bd
  
Karsten Hopp f409bd
! 			if (cin_nocode(l))
Karsten Hopp f409bd
! 			    continue;
Karsten Hopp f409bd
  
Karsten Hopp f409bd
! 		    }
Karsten Hopp f409bd
! 		    else if (lookfor != LOOKFOR_TERM
Karsten Hopp f409bd
! 					  && lookfor != LOOKFOR_CPP_BASECLASS)
Karsten Hopp f409bd
! 		    {
Karsten Hopp f409bd
! 			amount = scope_amount;
Karsten Hopp f409bd
! 			if (theline[0] == '{')
Karsten Hopp f409bd
! 			    amount += ind_open_extra;
Karsten Hopp f409bd
  		    }
Karsten Hopp f409bd
  		    break;
Karsten Hopp f409bd
  		}
Karsten Hopp f409bd
--- 7217,7275 ----
Karsten Hopp f409bd
  			else
Karsten Hopp f409bd
  			    amount += ind_continuation;
Karsten Hopp f409bd
  		    }
Karsten Hopp f409bd
! 		    else
Karsten Hopp f409bd
  		    {
Karsten Hopp f409bd
! 			if (lookfor != LOOKFOR_TERM
Karsten Hopp f409bd
! 					  && lookfor != LOOKFOR_CPP_BASECLASS)
Karsten Hopp f409bd
! 			{
Karsten Hopp f409bd
! 			    amount = scope_amount;
Karsten Hopp f409bd
! 			    if (theline[0] == '{')
Karsten Hopp f409bd
! 			    {
Karsten Hopp f409bd
! 				amount += ind_open_extra;
Karsten Hopp f409bd
! 				added_to_amount = ind_open_extra;
Karsten Hopp f409bd
! 			    }
Karsten Hopp f409bd
! 			}
Karsten Hopp f409bd
  
Karsten Hopp f409bd
! 			if (lookfor_cpp_namespace)
Karsten Hopp f409bd
! 			{
Karsten Hopp f409bd
! 			    /*
Karsten Hopp f409bd
! 			     * Looking for C++ namespace, need to look further
Karsten Hopp f409bd
! 			     * back.
Karsten Hopp f409bd
! 			     */
Karsten Hopp f409bd
! 			    if (curwin->w_cursor.lnum == ourscope)
Karsten Hopp f409bd
! 				continue;
Karsten Hopp f409bd
! 
Karsten Hopp f409bd
! 			    if (curwin->w_cursor.lnum == 0
Karsten Hopp f409bd
! 				    || curwin->w_cursor.lnum
Karsten Hopp f409bd
  					      < ourscope - FIND_NAMESPACE_LIM)
Karsten Hopp f409bd
! 				break;
Karsten Hopp f409bd
  
Karsten Hopp f409bd
! 			    l = ml_get_curline();
Karsten Hopp f409bd
  
Karsten Hopp f409bd
! 			    /* If we're in a comment now, skip to the start of
Karsten Hopp f409bd
! 			     * the comment. */
Karsten Hopp f409bd
! 			    trypos = find_start_comment(ind_maxcomment);
Karsten Hopp f409bd
! 			    if (trypos != NULL)
Karsten Hopp f409bd
! 			    {
Karsten Hopp f409bd
! 				curwin->w_cursor.lnum = trypos->lnum + 1;
Karsten Hopp f409bd
! 				curwin->w_cursor.col = 0;
Karsten Hopp f409bd
! 				continue;
Karsten Hopp f409bd
! 			    }
Karsten Hopp f409bd
  
Karsten Hopp f409bd
! 			    /* Skip preprocessor directives and blank lines. */
Karsten Hopp f409bd
! 			    if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum))
Karsten Hopp f409bd
! 				continue;
Karsten Hopp f409bd
  
Karsten Hopp f409bd
! 			    /* Finally the actual check for "namespace". */
Karsten Hopp f409bd
! 			    if (cin_is_cpp_namespace(l))
Karsten Hopp f409bd
! 			    {
Karsten Hopp f409bd
! 				amount += ind_cpp_namespace - added_to_amount;
Karsten Hopp f409bd
! 				break;
Karsten Hopp f409bd
! 			    }
Karsten Hopp f409bd
  
Karsten Hopp f409bd
! 			    if (cin_nocode(l))
Karsten Hopp f409bd
! 				continue;
Karsten Hopp f409bd
! 			}
Karsten Hopp f409bd
  		    }
Karsten Hopp f409bd
  		    break;
Karsten Hopp f409bd
  		}
Karsten Hopp f409bd
*** ../vim-7.3.331/src/testdir/test3.in	2011-07-20 15:09:38.000000000 +0200
Karsten Hopp f409bd
--- src/testdir/test3.in	2011-10-04 17:45:20.000000000 +0200
Karsten Hopp f409bd
***************
Karsten Hopp f409bd
*** 1309,1314 ****
Karsten Hopp f409bd
--- 1309,1328 ----
Karsten Hopp f409bd
  };
Karsten Hopp f409bd
  
Karsten Hopp f409bd
  STARTTEST
Karsten Hopp f409bd
+ :set cino=(0,gs,hs
Karsten Hopp f409bd
+ 2kdd]]=][
Karsten Hopp f409bd
+ ENDTEST
Karsten Hopp f409bd
+ 
Karsten Hopp f409bd
+ class Foo : public Bar
Karsten Hopp f409bd
+ {
Karsten Hopp f409bd
+ public:
Karsten Hopp f409bd
+ virtual void method1(void) = 0;
Karsten Hopp f409bd
+ virtual void method2(int arg1,
Karsten Hopp f409bd
+ int arg2,
Karsten Hopp f409bd
+ int arg3) = 0;
Karsten Hopp f409bd
+ };
Karsten Hopp f409bd
+ 
Karsten Hopp f409bd
+ STARTTEST
Karsten Hopp f409bd
  :set cino=+20
Karsten Hopp f409bd
  2kdd]]=][
Karsten Hopp f409bd
  ENDTEST
Karsten Hopp f409bd
*** ../vim-7.3.331/src/testdir/test3.ok	2011-07-20 15:09:38.000000000 +0200
Karsten Hopp f409bd
--- src/testdir/test3.ok	2011-10-04 17:47:25.000000000 +0200
Karsten Hopp f409bd
***************
Karsten Hopp f409bd
*** 1190,1195 ****
Karsten Hopp f409bd
--- 1190,1205 ----
Karsten Hopp f409bd
  };
Karsten Hopp f409bd
  
Karsten Hopp f409bd
  
Karsten Hopp f409bd
+ class Foo : public Bar
Karsten Hopp f409bd
+ {
Karsten Hopp f409bd
+ 	public:
Karsten Hopp f409bd
+ 		virtual void method1(void) = 0;
Karsten Hopp f409bd
+ 		virtual void method2(int arg1,
Karsten Hopp f409bd
+ 							 int arg2,
Karsten Hopp f409bd
+ 							 int arg3) = 0;
Karsten Hopp f409bd
+ };
Karsten Hopp f409bd
+ 
Karsten Hopp f409bd
+ 
Karsten Hopp f409bd
  	void
Karsten Hopp f409bd
  foo()
Karsten Hopp f409bd
  {
Karsten Hopp f409bd
*** ../vim-7.3.331/src/version.c	2011-10-04 17:00:13.000000000 +0200
Karsten Hopp f409bd
--- src/version.c	2011-10-04 18:02:17.000000000 +0200
Karsten Hopp f409bd
***************
Karsten Hopp f409bd
*** 711,712 ****
Karsten Hopp f409bd
--- 711,714 ----
Karsten Hopp f409bd
  {   /* Add new patch number below this line */
Karsten Hopp f409bd
+ /**/
Karsten Hopp f409bd
+     332,
Karsten Hopp f409bd
  /**/
Karsten Hopp f409bd
Karsten Hopp f409bd
-- 
Karsten Hopp f409bd
Latest survey shows that 3 out of 4 people make up 75% of the
Karsten Hopp f409bd
world's population.
Karsten Hopp f409bd
Karsten Hopp f409bd
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp f409bd
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp f409bd
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp f409bd
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///