forked from qt-creator/qt-creator
DiffEditor/VCS: Save document before applying/reverting patch chunk
Fixes: QTCREATORBUG-22506 Change-Id: I646f24068c0c81890f36052537320a743fdeb498 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
7edf743583
commit
f696d1e6cf
@@ -1578,7 +1578,14 @@ bool VcsBaseEditorWidget::hasDiff() const
|
||||
|
||||
void VcsBaseEditorWidget::slotApplyDiffChunk(const DiffChunk &chunk, PatchAction patchAction)
|
||||
{
|
||||
if (!PatchTool::confirmPatching(this, patchAction))
|
||||
auto textDocument = qobject_cast<TextEditor::TextDocument *>(
|
||||
DocumentModel::documentForFilePath(chunk.fileName));
|
||||
const bool isModified = textDocument && textDocument->isModified();
|
||||
|
||||
if (!PatchTool::confirmPatching(this, patchAction, isModified))
|
||||
return;
|
||||
|
||||
if (textDocument && !EditorManager::saveDocument(textDocument))
|
||||
return;
|
||||
|
||||
if (applyDiffChunk(chunk, patchAction) && patchAction == PatchAction::Revert)
|
||||
|
||||
Reference in New Issue
Block a user