diff --git a/src/lib_gui/qt/utility/QtHighlighter.cpp b/src/lib_gui/qt/utility/QtHighlighter.cpp index ea50ddc9..d3c916ac 100644 --- a/src/lib_gui/qt/utility/QtHighlighter.cpp +++ b/src/lib_gui/qt/utility/QtHighlighter.cpp @@ -379,12 +379,11 @@ std::vector> QtHighlighter::createMultiLineCommentRanges( if (!isInRange(cursorStart.selectionEnd(), *ranges)) { - cursorStart.setPosition(cursorStart.selectionEnd() - 2); break; } else { - cursorStart.setPosition(cursorStart.selectionEnd() + 2); + cursorStart.setPosition(cursorStart.selectionEnd() + 1); } } @@ -399,7 +398,7 @@ std::vector> QtHighlighter::createMultiLineCommentRanges( break; } - multiLineCommentRanges.push_back(std::pair(cursorStart.position(), cursorEnd.position())); + multiLineCommentRanges.push_back(std::pair(cursorStart.selectionStart(), cursorEnd.position())); cursorStart = cursorEnd; } diff --git a/testing/code_view/data/syntax_highlighter_tests.cpp b/testing/code_view/data/syntax_highlighter_tests.cpp index bbd84545..3353fe5e 100644 --- a/testing/code_view/data/syntax_highlighter_tests.cpp +++ b/testing/code_view/data/syntax_highlighter_tests.cpp @@ -32,6 +32,10 @@ namespace SYNTAX_HIGHLIGHTER_TESTS comment // end */ +/*/ + comment +/*/ + /* comment */ int no_comment; /* comment */ int no_comment2; /*