Commit 7d0d4679 authored by mae's avatar mae

obey the "auto-fold first comment" option also for reloads

parent dc713d06
......@@ -629,7 +629,7 @@ void BaseTextEditorPrivate::collapseLicenseHeader()
QTC_ASSERT(documentLayout, return);
QTextBlock block = doc->firstBlock();
const TabSettings &ts = m_document->tabSettings();
while (block.isValid()) {
while (block.isValid() && block.isVisible()) {
TextBlockUserData *data = TextBlockUserData::canCollapse(block);
if (data && block.next().isVisible()) {
QChar character;
......@@ -1348,14 +1348,18 @@ void BaseTextEditor::setBaseTextDocument(BaseTextDocument *doc)
}
}
// called before reload
void BaseTextEditor::memorizeCursorPosition()
{
d->m_tempState = saveState();
}
// called after reload
void BaseTextEditor::restoreCursorPosition()
{
restoreState(d->m_tempState);
if (d->m_displaySettings.m_autoFoldFirstComment)
d->collapseLicenseHeader();
}
QByteArray BaseTextEditor::saveState() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment