TextEditor: Fix jump to a search result to a folded block

Change-Id: Id9963bdf2a02930911753af046443e9b657bc9b9
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Artem Sokolovskii
2024-02-29 12:35:57 +01:00
parent cc763c80d7
commit 38ea622416

View File

@@ -3552,6 +3552,7 @@ void TextEditorWidget::restoreState(const QByteArray &state)
QTC_ASSERT(documentLayout, return); QTC_ASSERT(documentLayout, return);
documentLayout->requestUpdate(); documentLayout->requestUpdate();
documentLayout->emitDocumentSizeChanged(); documentLayout->emitDocumentSizeChanged();
d->updateCursorPosition();
} }
}; };
if (!singleShotAfterHighlightingDone(foldingRestore)) if (!singleShotAfterHighlightingDone(foldingRestore))
@@ -6696,6 +6697,9 @@ void TextEditorWidget::ensureBlockIsUnfolded(QTextBlock block)
void TextEditorWidgetPrivate::toggleBlockVisible(const QTextBlock &block) void TextEditorWidgetPrivate::toggleBlockVisible(const QTextBlock &block)
{ {
if (q->singleShotAfterHighlightingDone([this, block] { toggleBlockVisible(block); }))
return;
auto documentLayout = qobject_cast<TextDocumentLayout*>(q->document()->documentLayout()); auto documentLayout = qobject_cast<TextDocumentLayout*>(q->document()->documentLayout());
QTC_ASSERT(documentLayout, return); QTC_ASSERT(documentLayout, return);