MdTab: fix focus issue when toggling edit mode in a note without outline

This commit is contained in:
Le Tan 2019-04-03 21:53:18 +08:00
parent 93d2001519
commit b7fa135956

View File

@ -266,12 +266,13 @@ void VMdTab::showFileEditMode()
// 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 = 10; int nrRetry = 10;
while (header.m_index > -1 do {
&& nrRetry-- > 0 // We still need to wait even when there is no header to scroll since
&& (m_outline.isEmpty() || m_outline.getType() != VTableOfContentType::BlockNumber)) { // setCurrentMode()'s sendPostedEvents().
qDebug() << "wait another 100 ms for editor's headers ready";
VUtils::sleepWait(100); VUtils::sleepWait(100);
} } while (header.m_index > -1
&& nrRetry-- >= 0
&& (m_outline.isEmpty() || m_outline.getType() != VTableOfContentType::BlockNumber));
scrollEditorToHeader(header, false); scrollEditorToHeader(header, false);