forked from qt-creator/qt-creator
TextEditor: Fix continue highlighting
The highlightStartBlock was incorrectly set to the block that was just highlighted. This resulted in highlighting the same block over and over again if it took longer than 20 ms to highlight. Fix this by setting the highlightStartBlock after moving to the next block. Additionally make sure that highlightStartBlock is set to INT_MAX after the highlighting is done to ensure that the check of highlightStartBlock in SyntaxHighlighterPrivate::reformatBlocks always uses the correct start block. Change-Id: I69ea0c7463913d55076601b6a545c127e5382685 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -228,6 +228,7 @@ void SyntaxHighlighterPrivate::reformatBlocks()
|
||||
QTC_ASSERT(endBlock.isValid(), endBlock = doc->lastBlock());
|
||||
|
||||
while (block.isValid()) {
|
||||
highlightStartBlock = block.blockNumber();
|
||||
if (et.elapsed() > 20)
|
||||
break;
|
||||
|
||||
@@ -239,7 +240,6 @@ void SyntaxHighlighterPrivate::reformatBlocks()
|
||||
forceRehighlightBlocks.remove(block.blockNumber());
|
||||
forceHighlightOfNextBlock = (block.userState() != stateBeforeHighlight);
|
||||
}
|
||||
highlightStartBlock = block.blockNumber();
|
||||
|
||||
if (block == endBlock && !forceHighlightOfNextBlock)
|
||||
break;
|
||||
@@ -255,6 +255,7 @@ void SyntaxHighlighterPrivate::reformatBlocks()
|
||||
forceRehighlightBlocks << block.blockNumber();
|
||||
} else {
|
||||
highlightEndBlock = 0;
|
||||
highlightStartBlock = INT_MAX;
|
||||
syntaxInfoUpToDate = true;
|
||||
emit q->finished();
|
||||
}
|
||||
|
Reference in New Issue
Block a user