From f205b1223094ed24f4cc1230304a6cc4536f5411 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 18 Dec 2024 04:35:28 +0100 Subject: [PATCH] Fix UDL comment & comment line conflicting Fix #11897, close #15961 --- lexilla/lexers/LexUser.cxx | 58 +++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/lexilla/lexers/LexUser.cxx b/lexilla/lexers/LexUser.cxx index fe60a706d..baa3fe9cb 100644 --- a/lexilla/lexers/LexUser.cxx +++ b/lexilla/lexers/LexUser.cxx @@ -1979,6 +1979,35 @@ static void ColouriseUserDoc(Sci_PositionU startPos, Sci_Position length, int in break; } + if (!commentOpen.empty()) + { + if (isInListForward(commentOpen, sc, ignoreCase, openIndex, skipForward)) + { + if (foldComments) + { + isInComment = true; + if (isCommentLine != COMMENTLINE_SKIP_TESTING) + isCommentLine = COMMENTLINE_YES; + } + + // any backward keyword 'glued' on the left side? + setBackwards(kwLists, sc, prefixes, ignoreCase, bwNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + // paint up to start of comment sequence + sc.SetState(SCE_USER_STYLE_COMMENT); + // record start of comment sequence (NI_OPEN) in BOTH nesting vectors + nestedVector.push_back(*NI.Set(sc.currentPos, ++nestedLevel, openIndex, SCE_USER_STYLE_COMMENT, NI_OPEN)); + lastNestedGroup.push_back(NI); + // paint start of comment sequence + sc.Forward(skipForward); + sc.SetState(SCE_USER_STYLE_COMMENT); + dontMove = true; + if (sc.atLineEnd) + checkEOL = EOL_SKIP_CHECK; + + break; + } + } + if (!commentLineOpen.empty()) { if ((pureLC == PURE_LC_NONE) || @@ -2009,35 +2038,6 @@ static void ColouriseUserDoc(Sci_PositionU startPos, Sci_Position length, int in } } - if (!commentOpen.empty()) - { - if (isInListForward(commentOpen, sc, ignoreCase, openIndex, skipForward)) - { - if (foldComments) - { - isInComment = true; - if (isCommentLine != COMMENTLINE_SKIP_TESTING) - isCommentLine = COMMENTLINE_YES; - } - - // any backward keyword 'glued' on the left side? - setBackwards(kwLists, sc, prefixes, ignoreCase, bwNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - // paint up to start of comment sequence - sc.SetState(SCE_USER_STYLE_COMMENT); - // record start of comment sequence (NI_OPEN) in BOTH nesting vectors - nestedVector.push_back(*NI.Set(sc.currentPos, ++nestedLevel, openIndex, SCE_USER_STYLE_COMMENT, NI_OPEN)); - lastNestedGroup.push_back(NI); - // paint start of comment sequence - sc.Forward(skipForward); - sc.SetState(SCE_USER_STYLE_COMMENT); - dontMove = true; - if (sc.atLineEnd) - checkEOL = EOL_SKIP_CHECK; - - break; - } - } - for (int i=0; iempty())