Skip to content

Commit a65f695

Browse files
authored
Codeeditor: multiline comment fix (#4253)
1 parent 89a9e5e commit a65f695

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

gui/codeeditor.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,26 @@ Highlighter::Highlighter(QTextDocument *parent,
4545
<< "case"
4646
<< "catch"
4747
<< "char"
48-
<< "char8_­t"
49-
<< "char16_­t"
50-
<< "char32_­t"
48+
<< "char8_t"
49+
<< "char16_t"
50+
<< "char32_t"
5151
<< "class"
5252
<< "concept"
5353
<< "const"
5454
<< "consteval"
5555
<< "constexpr"
5656
<< "constinit"
57-
<< "const_­cast"
57+
<< "const_cast"
5858
<< "continue"
59-
<< "co_­await"
60-
<< "co_­return"
61-
<< "co_­yield"
59+
<< "co_await"
60+
<< "co_return"
61+
<< "co_yield"
6262
<< "decltype"
6363
<< "default"
6464
<< "delete"
6565
<< "do"
6666
<< "double"
67-
<< "dynamic_­cast"
67+
<< "dynamic_cast"
6868
<< "else"
6969
<< "enum"
7070
<< "explicit"
@@ -92,19 +92,19 @@ Highlighter::Highlighter(QTextDocument *parent,
9292
<< "private"
9393
<< "protected"
9494
<< "public"
95-
<< "reinterpret_­cast"
95+
<< "reinterpret_cast"
9696
<< "requires"
9797
<< "return"
9898
<< "short"
9999
<< "signed"
100100
<< "static"
101-
<< "static_­assert"
102-
<< "static_­cast"
101+
<< "static_assert"
102+
<< "static_cast"
103103
<< "struct"
104104
<< "switch"
105105
<< "template"
106106
<< "this"
107-
<< "thread_­local"
107+
<< "thread_local"
108108
<< "throw"
109109
<< "true"
110110
<< "try"
@@ -116,7 +116,7 @@ Highlighter::Highlighter(QTextDocument *parent,
116116
<< "virtual"
117117
<< "void"
118118
<< "volatile"
119-
<< "wchar_­t"
119+
<< "wchar_t"
120120
<< "while";
121121
for (const QString &pattern : keywordPatterns) {
122122
rule.pattern = QRegularExpression("\\b" + pattern + "\\b");
@@ -157,7 +157,9 @@ Highlighter::Highlighter(QTextDocument *parent,
157157
mSymbolFormat.setBackground(mWidgetStyle->symbolBGColor);
158158
mSymbolFormat.setFontWeight(mWidgetStyle->symbolWeight);
159159

160-
mCommentStartExpression = QRegularExpression("/\\*");
160+
// We use negative lookbehind assertion `(?<!/)`
161+
// to ignore case: single line comment and line of asterisk
162+
mCommentStartExpression = QRegularExpression("(?<!/)/\\*");
161163
mCommentEndExpression = QRegularExpression("\\*/");
162164
}
163165

0 commit comments

Comments
 (0)