From 244af93fb13a0c2ddc3cf9c620a6210d6d61079f Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 5 Apr 2002 07:03:05 +0000 Subject: Fixed folding problem when keywords appeared in document comments. --- src/LexCPP.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/LexCPP.cxx b/src/LexCPP.cxx index 40baea9dc..52af4de4c 100644 --- a/src/LexCPP.cxx +++ b/src/LexCPP.cxx @@ -263,6 +263,13 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo sc.Complete(); } +static bool IsStreamCommentStyle(int style) { + return style == SCE_C_COMMENT || + style == SCE_C_COMMENTDOC || + style == SCE_C_COMMENTDOCKEYWORD || + style == SCE_C_COMMENTDOCKEYWORDERROR; +} + static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; @@ -282,11 +289,10 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordLis style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - if (foldComment && - (style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC)) { - if (style != stylePrev) { + if (foldComment && IsStreamCommentStyle(style)) { + if (!IsStreamCommentStyle(stylePrev)) { levelCurrent++; - } else if ((style != styleNext) && !atEOL) { + } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelCurrent--; } -- cgit v1.2.3