Codeeditor class improvements (#4057)
This commit is contained in:
parent
e7afb3045b
commit
3ca2eb984e
|
@ -71,20 +71,24 @@ Highlighter::Highlighter(QTextDocument *parent,
|
|||
<< "export"
|
||||
<< "extern"
|
||||
<< "false"
|
||||
<< "final"
|
||||
<< "float"
|
||||
<< "for"
|
||||
<< "friend"
|
||||
<< "goto"
|
||||
<< "if"
|
||||
<< "import"
|
||||
<< "inline"
|
||||
<< "int"
|
||||
<< "long"
|
||||
<< "module"
|
||||
<< "mutable"
|
||||
<< "namespace"
|
||||
<< "new"
|
||||
<< "noexcept"
|
||||
<< "nullptr"
|
||||
<< "operator"
|
||||
<< "override"
|
||||
<< "private"
|
||||
<< "protected"
|
||||
<< "public"
|
||||
|
@ -130,7 +134,9 @@ Highlighter::Highlighter(QTextDocument *parent,
|
|||
|
||||
mQuotationFormat.setForeground(mWidgetStyle->quoteColor);
|
||||
mQuotationFormat.setFontWeight(mWidgetStyle->quoteWeight);
|
||||
rule.pattern = QRegularExpression("\".*\"");
|
||||
// We use lazy `*?` instead greed `*` quantifier to find the real end of the c-string.
|
||||
// We use negative lookbehind assertion `(?<!\)` to ignore `\"` sequience in the c-string.
|
||||
rule.pattern = QRegularExpression("\".*?(?<!\\\\)\"");
|
||||
rule.format = mQuotationFormat;
|
||||
rule.ruleRole = RuleRole::Quote;
|
||||
mHighlightingRules.append(rule);
|
||||
|
|
Loading…
Reference in New Issue