forked from qt-creator/qt-creator
TextEditor: fix applying empty list of format changes
The block might have had some highlighting before the update, so compare the new ranges against the one from the layout and update the layout if the format ranges differ. Change-Id: Ia6a0025e74fa8941b1cccc00baa93d3d37cb9ff9 Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
This commit is contained in:
@@ -185,7 +185,7 @@ void SyntaxHighlighterRunner::applyFormatRanges(const QList<SyntaxHighlighter::R
|
|||||||
|
|
||||||
result.copyToBlock(docBlock);
|
result.copyToBlock(docBlock);
|
||||||
|
|
||||||
if (!result.m_formatRanges.empty()) {
|
if (result.m_formatRanges != docBlock.layout()->formats()) {
|
||||||
TextDocumentLayout::FoldValidator foldValidator;
|
TextDocumentLayout::FoldValidator foldValidator;
|
||||||
foldValidator.setup(qobject_cast<TextDocumentLayout *>(m_document->documentLayout()));
|
foldValidator.setup(qobject_cast<TextDocumentLayout *>(m_document->documentLayout()));
|
||||||
docBlock.layout()->setFormats(result.m_formatRanges);
|
docBlock.layout()->setFormats(result.m_formatRanges);
|
||||||
|
Reference in New Issue
Block a user