lkundrak / rpms / vim

Forked from rpms/vim 4 years ago
Clone
9bf8d75
To: vim_dev@googlegroups.com
9bf8d75
Subject: Patch 7.3.363
9bf8d75
Fcc: outbox
9bf8d75
From: Bram Moolenaar <Bram@moolenaar.net>
9bf8d75
Mime-Version: 1.0
9bf8d75
Content-Type: text/plain; charset=UTF-8
9bf8d75
Content-Transfer-Encoding: 8bit
9bf8d75
------------
9bf8d75
9bf8d75
Patch 7.3.363
9bf8d75
Problem:    C indenting is wrong after #endif followed by a semicolon.
9bf8d75
Solution:   Add special handling for a semicolon in a line by itself. (Lech
9bf8d75
	    Lorens)
9bf8d75
Files:	    src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok
9bf8d75
9bf8d75
9bf8d75
*** ../vim-7.3.362/src/misc1.c	2011-11-30 13:03:24.000000000 +0100
9bf8d75
--- src/misc1.c	2011-11-30 17:10:59.000000000 +0100
9bf8d75
***************
9bf8d75
*** 8143,8148 ****
9bf8d75
--- 8143,8171 ----
9bf8d75
  		    break;
9bf8d75
  
9bf8d75
  		/*
9bf8d75
+ 		 * Find a line only has a semicolon that belongs to a previous
9bf8d75
+ 		 * line ending in '}', e.g. before an #endif.  Don't increase
9bf8d75
+ 		 * indent then.
9bf8d75
+ 		 */
9bf8d75
+ 		if (*(look = skipwhite(l)) == ';' && cin_nocode(look + 1))
9bf8d75
+ 		{
9bf8d75
+ 		    pos_T curpos_save = curwin->w_cursor;
9bf8d75
+ 
9bf8d75
+ 		    while (curwin->w_cursor.lnum > 1)
9bf8d75
+ 		    {
9bf8d75
+ 			look = ml_get(--curwin->w_cursor.lnum);
9bf8d75
+ 			if (!(cin_nocode(look) || cin_ispreproc_cont(
9bf8d75
+ 					      &look, &curwin->w_cursor.lnum)))
9bf8d75
+ 			    break;
9bf8d75
+ 		    }
9bf8d75
+ 		    if (curwin->w_cursor.lnum > 0
9bf8d75
+ 				    && cin_ends_in(look, (char_u *)"}", NULL))
9bf8d75
+ 			break;
9bf8d75
+ 
9bf8d75
+ 		    curwin->w_cursor = curpos_save;
9bf8d75
+ 		}
9bf8d75
+ 
9bf8d75
+ 		/*
9bf8d75
  		 * If the PREVIOUS line is a function declaration, the current
9bf8d75
  		 * line (and the ones that follow) needs to be indented as
9bf8d75
  		 * parameters.
9bf8d75
*** ../vim-7.3.362/src/testdir/test3.in	2011-10-04 18:03:43.000000000 +0200
9bf8d75
--- src/testdir/test3.in	2011-11-30 17:05:20.000000000 +0100
9bf8d75
***************
9bf8d75
*** 1454,1459 ****
9bf8d75
--- 1454,1469 ----
9bf8d75
  		printf("This line used to be indented incorrectly.\n");
9bf8d75
  }
9bf8d75
  
9bf8d75
+ int foo[]
9bf8d75
+ #ifdef BAR
9bf8d75
+ 
9bf8d75
+ = { 1, 2, 3,
9bf8d75
+ 	4, 5, 6 }
9bf8d75
+ 
9bf8d75
+ #endif
9bf8d75
+ ;
9bf8d75
+ 	int baz;
9bf8d75
+ 
9bf8d75
  void func3(void)
9bf8d75
  {
9bf8d75
  	int tab[] = {
9bf8d75
*** ../vim-7.3.362/src/testdir/test3.ok	2011-10-04 18:03:43.000000000 +0200
9bf8d75
--- src/testdir/test3.ok	2011-11-30 17:05:20.000000000 +0100
9bf8d75
***************
9bf8d75
*** 1307,1312 ****
9bf8d75
--- 1307,1322 ----
9bf8d75
  	printf("This line used to be indented incorrectly.\n");
9bf8d75
  }
9bf8d75
  
9bf8d75
+ int foo[]
9bf8d75
+ #ifdef BAR
9bf8d75
+ 
9bf8d75
+ = { 1, 2, 3,
9bf8d75
+ 	4, 5, 6 }
9bf8d75
+ 
9bf8d75
+ #endif
9bf8d75
+ 	;
9bf8d75
+ int baz;
9bf8d75
+ 
9bf8d75
  void func3(void)
9bf8d75
  {
9bf8d75
  	int tab[] = {
9bf8d75
*** ../vim-7.3.362/src/version.c	2011-11-30 17:01:55.000000000 +0100
9bf8d75
--- src/version.c	2011-11-30 17:06:57.000000000 +0100
9bf8d75
***************
9bf8d75
*** 716,717 ****
9bf8d75
--- 716,719 ----
9bf8d75
  {   /* Add new patch number below this line */
9bf8d75
+ /**/
9bf8d75
+     363,
9bf8d75
  /**/
9bf8d75
9bf8d75
-- 
9bf8d75
hundred-and-one symptoms of being an internet addict:
9bf8d75
220. Your wife asks for sex and you tell her where to find you on IRC.
9bf8d75
9bf8d75
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
9bf8d75
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
9bf8d75
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
9bf8d75
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///