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