Codeeditor class improvements (#4057)
This commit is contained in:
parent
e7afb3045b
commit
3ca2eb984e
|
@ -71,20 +71,24 @@ Highlighter::Highlighter(QTextDocument *parent,
|
||||||
<< "export"
|
<< "export"
|
||||||
<< "extern"
|
<< "extern"
|
||||||
<< "false"
|
<< "false"
|
||||||
|
<< "final"
|
||||||
<< "float"
|
<< "float"
|
||||||
<< "for"
|
<< "for"
|
||||||
<< "friend"
|
<< "friend"
|
||||||
<< "goto"
|
<< "goto"
|
||||||
<< "if"
|
<< "if"
|
||||||
|
<< "import"
|
||||||
<< "inline"
|
<< "inline"
|
||||||
<< "int"
|
<< "int"
|
||||||
<< "long"
|
<< "long"
|
||||||
|
<< "module"
|
||||||
<< "mutable"
|
<< "mutable"
|
||||||
<< "namespace"
|
<< "namespace"
|
||||||
<< "new"
|
<< "new"
|
||||||
<< "noexcept"
|
<< "noexcept"
|
||||||
<< "nullptr"
|
<< "nullptr"
|
||||||
<< "operator"
|
<< "operator"
|
||||||
|
<< "override"
|
||||||
<< "private"
|
<< "private"
|
||||||
<< "protected"
|
<< "protected"
|
||||||
<< "public"
|
<< "public"
|
||||||
|
@ -130,7 +134,9 @@ Highlighter::Highlighter(QTextDocument *parent,
|
||||||
|
|
||||||
mQuotationFormat.setForeground(mWidgetStyle->quoteColor);
|
mQuotationFormat.setForeground(mWidgetStyle->quoteColor);
|
||||||
mQuotationFormat.setFontWeight(mWidgetStyle->quoteWeight);
|
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.format = mQuotationFormat;
|
||||||
rule.ruleRole = RuleRole::Quote;
|
rule.ruleRole = RuleRole::Quote;
|
||||||
mHighlightingRules.append(rule);
|
mHighlightingRules.append(rule);
|
||||||
|
|
Loading…
Reference in New Issue