0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

updated for version 7.3.363

Problem:    C indenting is wrong after #endif followed by a semicolon.
Solution:   Add special handling for a semicolon in a line by itself. (Lech
            Lorens)
This commit is contained in:
Bram Moolenaar
2011-11-30 17:20:23 +01:00
parent 0612ec8d53
commit 3388bb4847
4 changed files with 45 additions and 0 deletions

View File

@@ -8142,6 +8142,29 @@ term_again:
if (cin_ends_in(l, (char_u *)"};", NULL))
break;
/*
* Find a line only has a semicolon that belongs to a previous
* line ending in '}', e.g. before an #endif. Don't increase
* indent then.
*/
if (*(look = skipwhite(l)) == ';' && cin_nocode(look + 1))
{
pos_T curpos_save = curwin->w_cursor;
while (curwin->w_cursor.lnum > 1)
{
look = ml_get(--curwin->w_cursor.lnum);
if (!(cin_nocode(look) || cin_ispreproc_cont(
&look, &curwin->w_cursor.lnum)))
break;
}
if (curwin->w_cursor.lnum > 0
&& cin_ends_in(look, (char_u *)"}", NULL))
break;
curwin->w_cursor = curpos_save;
}
/*
* If the PREVIOUS line is a function declaration, the current
* line (and the ones that follow) needs to be indented as

View File

@@ -1454,6 +1454,16 @@ void func2(void)
int tab[] =
{1, 2,
3, 4,
5, 6};
printf("This line used to be indented incorrectly.\n");
}
int foo[]
#ifdef BAR
= { 1, 2, 3,
4, 5, 6 }
#endif
;

View File

@@ -1307,6 +1307,16 @@ void func2(void)
printf("This line used to be indented incorrectly.\n");
}
int foo[]
#ifdef BAR
= { 1, 2, 3,
4, 5, 6 }
#endif
;
int baz;
void func3(void)
{
int tab[] = {

View File

@@ -714,6 +714,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
363,
/**/
362,
/**/