diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2012-10-15 14:11:42 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@digia.com> | 2012-10-15 16:43:34 +0200 |
commit | fe5548510953e1bef13a8538a9c5b2e115a31f9f (patch) | |
tree | 12d55b806f25f536a148fc818b86941b95bc90eb /src/plugins/texteditor/syntaxhighlighter.cpp | |
parent | dcbc4d825546d343f1bbf89ba56dc875c87be3c1 (diff) |
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: Pierre Rossi <pierre.rossi@gmail.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src/plugins/texteditor/syntaxhighlighter.cpp')
-rw-r--r-- | src/plugins/texteditor/syntaxhighlighter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/texteditor/syntaxhighlighter.cpp b/src/plugins/texteditor/syntaxhighlighter.cpp index 8c81bda4805..f39e8c6d2fc 100644 --- a/src/plugins/texteditor/syntaxhighlighter.cpp +++ b/src/plugins/texteditor/syntaxhighlighter.cpp @@ -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; |