diff options
-rw-r--r-- | lexers/LexCPP.cxx | 7 | ||||
-rw-r--r-- | test/examples/x.cxx | 5 | ||||
-rw-r--r-- | test/examples/x.cxx.styled | 5 |
3 files changed, 14 insertions, 3 deletions
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 51752db85..c3c69b703 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -527,6 +527,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, // ends with a line continuation by locking in the state upto this position. sc.SetState(sc.state); } + if ((MaskActive(sc.state) == SCE_C_PREPROCESSOR) && (!continuationLine)) { + sc.SetState(SCE_C_DEFAULT|activitySet); + } // Reset states to begining of colourise so no surprises // if different sets of lines lexed. visibleChars = 0; @@ -610,9 +613,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, } break; case SCE_C_PREPROCESSOR: - if (sc.atLineStart && !continuationLine) { - sc.SetState(SCE_C_DEFAULT|activitySet); - } else if (options.stylingWithinPreprocessor) { + if (options.stylingWithinPreprocessor) { if (IsASpace(sc.ch)) { sc.SetState(SCE_C_DEFAULT|activitySet); } diff --git a/test/examples/x.cxx b/test/examples/x.cxx index 811a4034a..7d020ba10 100644 --- a/test/examples/x.cxx +++ b/test/examples/x.cxx @@ -4,6 +4,11 @@ #define DUMMY() \ if (1); #endif + +#define M\ + +\ + int main() { double x[] = {3.14159,6.02e23,1.6e-19,1.0+1}; int y[] = {75,0113,0x4b}; diff --git a/test/examples/x.cxx.styled b/test/examples/x.cxx.styled index ad259f893..082c6c3e0 100644 --- a/test/examples/x.cxx.styled +++ b/test/examples/x.cxx.styled @@ -4,6 +4,11 @@ {73}#define DUMMY() \ if (1); {9}#endif +{0} +{9}#define M\ + +{0}\ + {5}int{0} {11}main{10}(){0} {10}{{0} {11}double{0} {11}x{10}[]{0} {10}={0} {10}{{4}3.14159{10},{4}6.02e23{10},{4}1.6e-19{10},{4}1.0{10}+{4}1{10}};{0} {5}int{0} {11}y{10}[]{0} {10}={0} {10}{{4}75{10},{4}0113{10},{4}0x4b{10}};{0} |