From 950c9398bf287a18ba487bc44aaf18be8015894a Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Tue, 10 Oct 2023 16:37:10 +0200 Subject: [PATCH] Fixed diff buttons disappearing when using split mode Fixes #169 --- .../kotlin/com/jetpackduba/gitnuro/git/diff/DiffResult.kt | 6 ++++-- src/main/kotlin/com/jetpackduba/gitnuro/ui/diff/Diff.kt | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/diff/DiffResult.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/diff/DiffResult.kt index 7faeb0c..8014b67 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/diff/DiffResult.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/diff/DiffResult.kt @@ -7,15 +7,17 @@ import org.eclipse.jgit.submodule.SubmoduleStatus sealed class DiffResult( val diffEntry: DiffEntry, ) { + sealed class TextDiff(diffEntry: DiffEntry): DiffResult(diffEntry) + class Text( diffEntry: DiffEntry, val hunks: List - ) : DiffResult(diffEntry) + ) : TextDiff(diffEntry) class TextSplit( diffEntry: DiffEntry, val hunks: List - ) : DiffResult(diffEntry) + ) : TextDiff(diffEntry) class NonText( diffEntry: DiffEntry, diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/ui/diff/Diff.kt b/src/main/kotlin/com/jetpackduba/gitnuro/ui/diff/Diff.kt index 1a0f0a7..23b662d 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/ui/diff/Diff.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/ui/diff/Diff.kt @@ -121,7 +121,7 @@ fun Diff( diffEntry = diffEntry, onCloseDiffView = onCloseDiffView, diffType = diffType, - isTextDiff = diffResult is DiffResult.Text, + isTextDiff = diffResult is DiffResult.TextDiff, isDisplayFullFile = isDisplayFullFile, onStageFile = { diffViewModel.stageFile(it) }, onUnstageFile = { diffViewModel.unstageFile(it) },