forked from qt-creator/qt-creator
CppEditor: Fully handle raw string literals in the syntax highlighter
As of a3af941adf, the built-in highlighter
can properly handle multi-line raw string literals, so we don't need to
abuse the semantic highlighter for this anymore.
Fixes: QTCREATORBUG-26693
Fixes: QTCREATORBUG-28284
Change-Id: If644767dfa8a97294e84a541eea44143e8d1bb88
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -478,8 +478,7 @@ void SyntaxHighlighter::setFormatWithSpaces(const QString &text, int start, int
|
||||
const QTextCharFormat &format)
|
||||
{
|
||||
Q_D(const SyntaxHighlighter);
|
||||
QTextCharFormat visualSpaceFormat = d->whitespaceFormat;
|
||||
visualSpaceFormat.setBackground(format.background());
|
||||
const QTextCharFormat visualSpaceFormat = whitespacified(format);
|
||||
|
||||
const int end = std::min(start + count, int(text.length()));
|
||||
int index = start;
|
||||
@@ -809,6 +808,14 @@ QTextCharFormat SyntaxHighlighter::formatForCategory(int category) const
|
||||
return d->formats.at(category);
|
||||
}
|
||||
|
||||
QTextCharFormat SyntaxHighlighter::whitespacified(const QTextCharFormat &fmt)
|
||||
{
|
||||
Q_D(SyntaxHighlighter);
|
||||
QTextCharFormat format = d->whitespaceFormat;
|
||||
format.setBackground(fmt.background());
|
||||
return format;
|
||||
}
|
||||
|
||||
void SyntaxHighlighter::highlightBlock(const QString &text)
|
||||
{
|
||||
formatSpaces(text);
|
||||
|
||||
Reference in New Issue
Block a user