mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 7.4.912
Problem: Wrong indenting for C++ constructor. Solution: Recognize ::. (Anhong)
This commit is contained in:
13
src/misc1.c
13
src/misc1.c
@@ -6250,6 +6250,19 @@ cin_isfuncdecl(sp, first_lnum, min_lnum)
|
|||||||
{
|
{
|
||||||
if (cin_iscomment(s)) /* ignore comments */
|
if (cin_iscomment(s)) /* ignore comments */
|
||||||
s = cin_skipcomment(s);
|
s = cin_skipcomment(s);
|
||||||
|
else if (*s == ':')
|
||||||
|
{
|
||||||
|
if (*(s + 1) == ':')
|
||||||
|
s += 2;
|
||||||
|
else
|
||||||
|
/* To avoid a mistake in the following situation:
|
||||||
|
* A::A(int a, int b)
|
||||||
|
* : a(0) // <--not a function decl
|
||||||
|
* , b(0)
|
||||||
|
* {...
|
||||||
|
*/
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
|
@@ -663,6 +663,13 @@ Constructor::Constructor(int a,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
A::A(int a, int b)
|
||||||
|
: aa(a),
|
||||||
|
bb(b),
|
||||||
|
cc(c)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class CAbc :
|
class CAbc :
|
||||||
public BaseClass1,
|
public BaseClass1,
|
||||||
protected BaseClass2
|
protected BaseClass2
|
||||||
|
@@ -651,6 +651,13 @@ Constructor::Constructor(int a,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
A::A(int a, int b)
|
||||||
|
: aa(a),
|
||||||
|
bb(b),
|
||||||
|
cc(c)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class CAbc :
|
class CAbc :
|
||||||
public BaseClass1,
|
public BaseClass1,
|
||||||
protected BaseClass2
|
protected BaseClass2
|
||||||
|
@@ -741,6 +741,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 */
|
||||||
|
/**/
|
||||||
|
912,
|
||||||
/**/
|
/**/
|
||||||
911,
|
911,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user