bug-fix: can not jump to the correct header when first enter edit mode

This commit is contained in:
Le Tan 2018-04-27 20:35:45 +08:00
parent 89375680b4
commit adacaef1c7

View File

@ -234,8 +234,10 @@ void VMdTab::showFileEditMode()
// If editor is not init, we need to wait for it to init headers. // If editor is not init, we need to wait for it to init headers.
// Generally, beginEdit() will generate the headers. Wait is needed when // Generally, beginEdit() will generate the headers. Wait is needed when
// highlight completion is going to re-generate the headers. // highlight completion is going to re-generate the headers.
int nrRetry = 5; int nrRetry = 10;
while (header.m_index > -1 && m_outline.isEmpty() && nrRetry-- > 0) { while (header.m_index > -1
&& nrRetry-- > 0
&& (m_outline.isEmpty() || m_outline.getType() != VTableOfContentType::BlockNumber)) {
qDebug() << "wait another 100 ms for editor's headers ready"; qDebug() << "wait another 100 ms for editor's headers ready";
VUtils::sleepWait(100); VUtils::sleepWait(100);
} }