forked from qt-creator/qt-creator
UnifiedDiffEditor: Move setting folding markers into thread
Change-Id: I4fc6f08039813c08e70a6798f65abcea219558be Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -545,10 +545,6 @@ void UnifiedDiffEditorWidget::showDiff()
|
|||||||
setTextDocument(doc);
|
setTextDocument(doc);
|
||||||
|
|
||||||
setReadOnly(true);
|
setReadOnly(true);
|
||||||
|
|
||||||
QTextBlock block = document()->firstBlock();
|
|
||||||
for (int b = 0; block.isValid(); block = block.next(), ++b)
|
|
||||||
setFoldingIndent(block, result.foldingIndent.value(b, 3));
|
|
||||||
}
|
}
|
||||||
setSelections(result.selections);
|
setSelections(result.selections);
|
||||||
}
|
}
|
||||||
@@ -574,7 +570,7 @@ void UnifiedDiffEditorWidget::showDiff()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const ShowResult result = {TextDocumentPtr(new TextDocument("DiffEditor.UnifiedDiffEditor")),
|
const ShowResult result = {TextDocumentPtr(new TextDocument("DiffEditor.UnifiedDiffEditor")),
|
||||||
diffData, output.foldingIndent, output.selections};
|
diffData, output.selections};
|
||||||
// No need to store the change history
|
// No need to store the change history
|
||||||
result.textDocument->document()->setUndoRedoEnabled(false);
|
result.textDocument->document()->setUndoRedoEnabled(false);
|
||||||
|
|
||||||
@@ -595,6 +591,10 @@ void UnifiedDiffEditorWidget::showDiff()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTextBlock block = result.textDocument->document()->firstBlock();
|
||||||
|
for (int b = 0; block.isValid(); block = block.next(), ++b)
|
||||||
|
setFoldingIndent(block, output.foldingIndent.value(b, 3));
|
||||||
|
|
||||||
// If future was canceled, the destructor runs in this thread, so we can't move it
|
// If future was canceled, the destructor runs in this thread, so we can't move it
|
||||||
// to caller's thread. We push it to no thread (make object to have no thread affinity),
|
// to caller's thread. We push it to no thread (make object to have no thread affinity),
|
||||||
// and later, in the caller's thread, we pull it back to the caller's thread.
|
// and later, in the caller's thread, we pull it back to the caller's thread.
|
||||||
|
@@ -115,7 +115,6 @@ private:
|
|||||||
{
|
{
|
||||||
QSharedPointer<TextEditor::TextDocument> textDocument;
|
QSharedPointer<TextEditor::TextDocument> textDocument;
|
||||||
UnifiedDiffData diffData;
|
UnifiedDiffData diffData;
|
||||||
QHash<int, int> foldingIndent;
|
|
||||||
DiffSelections selections;
|
DiffSelections selections;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user