forked from aniani/vim
patch 7.4.893
Problem: C indenting is wrong below a "case (foo):" because it is recognized as a C++ base class construct. Issue #38. Solution: Check for the case keyword.
This commit is contained in:
@@ -6555,7 +6555,7 @@ cin_is_cpp_baseclass(cached)
|
|||||||
|
|
||||||
pos->lnum = lnum;
|
pos->lnum = lnum;
|
||||||
line = ml_get(lnum);
|
line = ml_get(lnum);
|
||||||
s = cin_skipcomment(line);
|
s = line;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (*s == NUL)
|
if (*s == NUL)
|
||||||
@@ -6564,6 +6564,13 @@ cin_is_cpp_baseclass(cached)
|
|||||||
break;
|
break;
|
||||||
/* Continue in the cursor line. */
|
/* Continue in the cursor line. */
|
||||||
line = ml_get(++lnum);
|
line = ml_get(++lnum);
|
||||||
|
s = line;
|
||||||
|
}
|
||||||
|
if (s == line)
|
||||||
|
{
|
||||||
|
/* don't recognize "case (foo):" as a baseclass */
|
||||||
|
if (cin_iscase(s, FALSE))
|
||||||
|
break;
|
||||||
s = cin_skipcomment(line);
|
s = cin_skipcomment(line);
|
||||||
if (*s == NUL)
|
if (*s == NUL)
|
||||||
continue;
|
continue;
|
||||||
|
@@ -932,6 +932,33 @@ if (1)
|
|||||||
a = 1;
|
a = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void func()
|
||||||
|
{
|
||||||
|
switch (foo)
|
||||||
|
{
|
||||||
|
case (bar):
|
||||||
|
if (baz())
|
||||||
|
quux();
|
||||||
|
break;
|
||||||
|
case (shmoo):
|
||||||
|
if (!bar)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
case (foo1):
|
||||||
|
switch (bar)
|
||||||
|
{
|
||||||
|
case baz:
|
||||||
|
baz_f();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
baz();
|
||||||
|
baz();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* end of AUTO */
|
/* end of AUTO */
|
||||||
|
|
||||||
STARTTEST
|
STARTTEST
|
||||||
|
@@ -920,6 +920,33 @@ void getstring() {
|
|||||||
a = 1;
|
a = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void func()
|
||||||
|
{
|
||||||
|
switch (foo)
|
||||||
|
{
|
||||||
|
case (bar):
|
||||||
|
if (baz())
|
||||||
|
quux();
|
||||||
|
break;
|
||||||
|
case (shmoo):
|
||||||
|
if (!bar)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
case (foo1):
|
||||||
|
switch (bar)
|
||||||
|
{
|
||||||
|
case baz:
|
||||||
|
baz_f();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
baz();
|
||||||
|
baz();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* end of AUTO */
|
/* end of AUTO */
|
||||||
|
|
||||||
|
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
893,
|
||||||
/**/
|
/**/
|
||||||
892,
|
892,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user