From f83e42b0a9bfd93d8d136e994ab6920439ff8e52 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 27 Aug 2010 20:31:23 +1000 Subject: Fixed bugs caused by ignoring single character \n line ends on #include lines causing preprocessor memory to be out of sync. --- lexers/LexCPP.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lexers') diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 588f42e6e..2028c66a9 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -504,6 +504,8 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, } } + const bool atLineEndBeforeSwitch = sc.atLineEnd; + // Determine if the current state should terminate. switch (sc.state & maskActivity) { case SCE_C_OPERATOR: @@ -661,6 +663,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, } } + if (sc.atLineEnd && !atLineEndBeforeSwitch) { + // State exit processing consumed characters up to end of line. + lineCurrent++; + vlls.Add(lineCurrent, preproc); + } + // Determine if a new state should be entered. if ((sc.state & maskActivity) == SCE_C_DEFAULT) { if (sc.Match('@', '\"')) { -- cgit v1.2.3