Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2013-01-18 00:02:35 +0000
committerSergey Prigogin2013-01-18 00:07:40 +0000
commita30919dff8048044f7ffec6ba59ee7c64bb0b234 (patch)
tree3b19c71253d1a33c21803fff548f89f8f53f7dfb
parentebc742598c34868a81f35421ef6bd232ef0658e7 (diff)
downloadorg.eclipse.cdt-a30919dff8048044f7ffec6ba59ee7c64bb0b234.tar.gz
org.eclipse.cdt-a30919dff8048044f7ffec6ba59ee7c64bb0b234.tar.xz
org.eclipse.cdt-a30919dff8048044f7ffec6ba59ee7c64bb0b234.zip
Bug 398459 - Invalid auto-indentation in a virtual method
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java11
2 files changed, 12 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java
index 52fac36670d..e1389e636aa 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java
@@ -432,7 +432,7 @@ public class CIndenterTest extends BaseUITestCase {
//class MyClass {
//typedef int MyType;
//public:
- //int getA() {
+ //virtual int getA() {
//return a;
//}
//MyClass();
@@ -444,7 +444,7 @@ public class CIndenterTest extends BaseUITestCase {
//class MyClass {
// typedef int MyType;
// public:
- // int getA() {
+ // virtual int getA() {
// return a;
// }
// MyClass();
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java
index cb08370dc4e..14fe12bf58d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java
@@ -1409,8 +1409,17 @@ public final class CIndenter {
case Symbols.TokenPRIVATE:
case Symbols.TokenPROTECTED:
case Symbols.TokenPUBLIC:
- case Symbols.TokenVIRTUAL:
continue; // Don't stop at colon in a class declaration
+
+ case Symbols.TokenVIRTUAL:
+ switch (peekToken()) {
+ case Symbols.TokenPRIVATE:
+ case Symbols.TokenPROTECTED:
+ case Symbols.TokenPUBLIC:
+ break;
+ default:
+ continue;
+ }
}
int pos= fPreviousPos;
if (!isConditional())

Back to the top