From 122a06b3ac309caacd132fc556d6b47e53c1a86f Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 10 May 2017 15:27:24 +0300 Subject: [PATCH] IDEABKL-6460 lst: do not save file if auto-save disabled --- .../openapi/vcs/ex/LineStatusTracker.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java index 80d047e643d4..36085774df5b 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java @@ -16,6 +16,7 @@ package com.intellij.openapi.vcs.ex; import com.intellij.diff.util.DiffUtil; +import com.intellij.ide.GeneralSettings; import com.intellij.openapi.application.TransactionGuard; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; @@ -173,15 +174,17 @@ public class LineStatusTracker extends LineStatusTrackerBase { @Override @CalledInAwt protected void fireFileUnchanged() { - // later to avoid saving inside document change event processing. - TransactionGuard.getInstance().submitTransactionLater(getProject(), () -> { - FileDocumentManager.getInstance().saveDocument(myDocument); - List ranges = getRanges(); - if (ranges == null || ranges.isEmpty()) { - // file was modified, and now it's not -> dirty local change - myVcsDirtyScopeManager.fileDirty(myVirtualFile); - } - }); + if (GeneralSettings.getInstance().isSaveOnFrameDeactivation()) { + // later to avoid saving inside document change event processing. + TransactionGuard.getInstance().submitTransactionLater(getProject(), () -> { + FileDocumentManager.getInstance().saveDocument(myDocument); + List ranges = getRanges(); + if (ranges == null || ranges.isEmpty()) { + // file was modified, and now it's not -> dirty local change + myVcsDirtyScopeManager.fileDirty(myVirtualFile); + } + }); + } } @Override