Skip to content

Commit f8c53d3

Browse files
committed
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)
1 parent 80eaddd commit f8c53d3

4 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/search.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2280,7 +2280,7 @@ findmatchlimit(
22802280
{
22812281
/*
22822282
* A comment may contain / * or / /, it may also start or end
2283-
* with / * /. Ignore a / * after / /.
2283+
* with / * /. Ignore a / * after / / and after *.
22842284
*/
22852285
if (pos.col == 0)
22862286
continue;
@@ -2306,6 +2306,7 @@ findmatchlimit(
23062306
}
23072307
else if ( linep[pos.col - 1] == '/'
23082308
&& linep[pos.col] == '*'
2309+
&& (pos.col == 1 || linep[pos.col - 2] != '*')
23092310
&& (int)pos.col < comment_col)
23102311
{
23112312
count++;

src/testdir/test3.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,6 +2338,16 @@ CCC
23382338
4
23392339
/* end of define */
23402340

2341+
STARTTEST
2342+
:set cin cino&
2343+
/a = second
2344+
ox
2345+
ENDTEST
2346+
2347+
{
2348+
a = second/*bug*/*line;
2349+
}
2350+
23412351
STARTTEST
23422352
:g/^STARTTEST/.,/^ENDTEST/d
23432353
:1;/start of AUTO/,$wq! test.out

src/testdir/test3.ok

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,3 +2094,9 @@ JSEND
20942094
4
20952095
/* end of define */
20962096

2097+
2098+
{
2099+
a = second/*bug*/*line;
2100+
x
2101+
}
2102+

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1291,
764766
/**/
765767
1290,
766768
/**/

0 commit comments

Comments
 (0)