mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 14:29:54 +08:00
bugfix: abandon obsolete parsed highlight result when text has been changed
This commit is contained in:
parent
fc6aefc66f
commit
bd7f0e6cdd
@ -414,6 +414,12 @@ void HGMarkdownHighlighter::setCodeBlockHighlights(const QList<HLUnitPos> &p_uni
|
|||||||
int end = unit.m_position + unit.m_length;
|
int end = unit.m_position + unit.m_length;
|
||||||
int startBlockNum = document->findBlock(pos).blockNumber();
|
int startBlockNum = document->findBlock(pos).blockNumber();
|
||||||
int endBlockNum = document->findBlock(end).blockNumber();
|
int endBlockNum = document->findBlock(end).blockNumber();
|
||||||
|
|
||||||
|
// Text has been changed. Abandon the obsolete parsed result.
|
||||||
|
if (startBlockNum == -1 || endBlockNum >= highlights.size()) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = startBlockNum; i <= endBlockNum; ++i)
|
for (int i = startBlockNum; i <= endBlockNum; ++i)
|
||||||
{
|
{
|
||||||
QTextBlock block = document->findBlockByNumber(i);
|
QTextBlock block = document->findBlockByNumber(i);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user