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:
David Schulz
2024-02-08 11:07:40 +01:00
parent 7b65432688
commit 1cddc3d0b6

View File

@@ -185,7 +185,7 @@ void SyntaxHighlighterRunner::applyFormatRanges(const QList<SyntaxHighlighter::R
result.copyToBlock(docBlock);
if (!result.m_formatRanges.empty()) {
if (result.m_formatRanges != docBlock.layout()->formats()) {
TextDocumentLayout::FoldValidator foldValidator;
foldValidator.setup(qobject_cast<TextDocumentLayout *>(m_document->documentLayout()));
docBlock.layout()->setFormats(result.m_formatRanges);