Commit fe554851 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

C++: do not set any highlighting ranges on empty lines.



This can happen when the semantic highlighter (which runs in a future)
calculates a range for a document that has been changed in the meantime.

Task-number: QTCREATORBUG-7995
Change-Id: Ibcd1a6ae840e08570a6b6ea4caf411e799ec26c8
Reviewed-by: default avatarPierre Rossi <pierre.rossi@gmail.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent dcbc4d82
......@@ -695,15 +695,18 @@ static bool byStartOfRange(const QTextLayout::FormatRange &range, const QTextLay
void SyntaxHighlighter::setExtraAdditionalFormats(const QTextBlock& block,
const QList<QTextLayout::FormatRange> &fmts)
{
// qDebug() << "setAdditionalFormats() on block" << block.blockNumber();
// qDebug() << " is valid:" << (block.isValid() ? "Yes" : "No");
// qDebug() << " has layout:" << (block.layout() ? "Yes" : "No");
// if (block.layout()) qDebug() << " has text:" << (block.text().isEmpty() ? "No" : "Yes");
// for (int i = 0; i < overrides.count(); ++i)
// qDebug() << " from " << overrides.at(i).start << "length"
// << overrides.at(i).length
// << "color:" << overrides.at(i).format.foreground().color();
Q_D(SyntaxHighlighter);
if (block.layout() == 0)
if (block.layout() == 0 || block.text().isEmpty())
return;
QList<QTextLayout::FormatRange> formats;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment