0
0
mirror of https://github.com/vim/vim.git synced 2025-09-14 23:14:27 -04:00

patch 8.0.1291: C indent wrong when * immediately follows comment

Problem:    C indent wrong when * immediately follows comment. (John Bowler)
Solution:   Do not see "/*" after "*" as a comment start. (closes #2321)
This commit is contained in:
Bram Moolenaar 2017-11-12 15:36:38 +01:00
parent 80eaddd3a0
commit f8c53d3d26
4 changed files with 20 additions and 1 deletions

View File

@ -2280,7 +2280,7 @@ findmatchlimit(
{ {
/* /*
* A comment may contain / * or / /, it may also start or end * A comment may contain / * or / /, it may also start or end
* with / * /. Ignore a / * after / /. * with / * /. Ignore a / * after / / and after *.
*/ */
if (pos.col == 0) if (pos.col == 0)
continue; continue;
@ -2306,6 +2306,7 @@ findmatchlimit(
} }
else if ( linep[pos.col - 1] == '/' else if ( linep[pos.col - 1] == '/'
&& linep[pos.col] == '*' && linep[pos.col] == '*'
&& (pos.col == 1 || linep[pos.col - 2] != '*')
&& (int)pos.col < comment_col) && (int)pos.col < comment_col)
{ {
count++; count++;

View File

@ -2338,6 +2338,16 @@ CCC
4 4
/* end of define */ /* end of define */
STARTTEST
:set cin cino&
/a = second
ox
ENDTEST
{
a = second/*bug*/*line;
}
STARTTEST STARTTEST
:g/^STARTTEST/.,/^ENDTEST/d :g/^STARTTEST/.,/^ENDTEST/d
:1;/start of AUTO/,$wq! test.out :1;/start of AUTO/,$wq! test.out

View File

@ -2094,3 +2094,9 @@ JSEND
4 4
/* end of define */ /* end of define */
{
a = second/*bug*/*line;
x
}

View File

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