From ded6ea3c133c7c591bc82670a4e1e4174fca033f Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 7 Mar 2013 12:39:44 +1100 Subject: Bug: [#482]. Refix to make /// comment not affect folding of following /* comment. --- lexers/LexCPP.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index a064328c8..4f3b4f509 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -1041,6 +1041,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, unsigned int endPos = startPos + length; int visibleChars = 0; + bool inLineComment = false; int lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) @@ -1059,10 +1060,12 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, style = styleNext; styleNext = MaskActive(styler.StyleAt(i + 1)); bool atEOL = i == (lineStartNext-1); - if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style)) { - if (!IsStreamCommentStyle(stylePrev) && (stylePrev != SCE_C_COMMENTLINEDOC)) { + if ((style == SCE_C_COMMENTLINE) || (style == SCE_C_COMMENTLINEDOC)) + inLineComment = true; + if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style) && !inLineComment) { + if (!IsStreamCommentStyle(stylePrev)) { levelNext++; - } else if (!IsStreamCommentStyle(styleNext) && (styleNext != SCE_C_COMMENTLINEDOC) && !atEOL) { + } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelNext--; } @@ -1134,6 +1137,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } visibleChars = 0; + inLineComment = false; } } } -- cgit v1.2.3