diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/savedPatches/SavedPatchesUi.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/savedPatches/SavedPatchesUi.kt index 74bf66db08d8..ab94bbf6b578 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/savedPatches/SavedPatchesUi.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/savedPatches/SavedPatchesUi.kt @@ -8,6 +8,7 @@ import com.intellij.openapi.actionSystem.* import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer import com.intellij.openapi.vcs.VcsBundle +import com.intellij.openapi.vcs.changes.shouldHaveSplitterDiffPreview import com.intellij.ui.* import com.intellij.util.EditSourceOnDoubleClickHandler import com.intellij.util.Processor @@ -23,13 +24,15 @@ import java.awt.FlowLayout import javax.swing.* import javax.swing.border.CompoundBorder -open class SavedPatchesUi(project: Project, - @ApiStatus.Internal val providers: List>, - private val isVertical: () -> Boolean, - private val isWithSplitDiffPreview: () -> Boolean, - private val isShowDiffWithLocal: () -> Boolean, - focusMainUi: (Component?) -> Unit, - disposable: Disposable) : +open class SavedPatchesUi( + private val project: Project, + @ApiStatus.Internal val providers: List>, + private val isVertical: () -> Boolean, + private val isWithSplitDiffPreview: () -> Boolean, + private val isShowDiffWithLocal: () -> Boolean, + focusMainUi: (Component?) -> Unit, + disposable: Disposable, +) : JPanel(BorderLayout()), Disposable, UiDataProvider { protected val patchesTree: SavedPatchesTree @@ -140,7 +143,7 @@ open class SavedPatchesUi(project: Project, private fun updateLayout(isInitial: Boolean) { val isVertical = isVertical() - val isWithSplitPreview = !isVertical && isWithSplitDiffPreview() + val isWithSplitPreview = shouldHaveSplitterDiffPreview(project, isVertical) && isWithSplitDiffPreview() val isChangesSplitterVertical = isVertical || isWithSplitPreview if (treeChangesSplitter.orientation != isChangesSplitterVertical) { treeChangesSplitter.orientation = isChangesSplitterVertical diff --git a/plugins/git4idea/src/git4idea/stash/ui/GitStashToggleSplitPreviewAction.kt b/plugins/git4idea/src/git4idea/stash/ui/GitStashToggleSplitPreviewAction.kt index 8687665eea6c..d16bb96593e0 100644 --- a/plugins/git4idea/src/git4idea/stash/ui/GitStashToggleSplitPreviewAction.kt +++ b/plugins/git4idea/src/git4idea/stash/ui/GitStashToggleSplitPreviewAction.kt @@ -5,6 +5,7 @@ import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.project.DumbAwareToggleAction +import com.intellij.openapi.vcs.changes.shouldHaveSplitterDiffPreview import git4idea.config.GitVcsApplicationSettings internal class GitStashToggleSplitPreviewAction : DumbAwareToggleAction() { @@ -15,7 +16,7 @@ internal class GitStashToggleSplitPreviewAction : DumbAwareToggleAction() { e.presentation.isEnabledAndVisible = false return } - e.presentation.isEnabledAndVisible = !isStashTabVertical(project) + e.presentation.isEnabledAndVisible = shouldHaveSplitterDiffPreview(project, isStashTabVertical(project)) } override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT