Uncommited changes line is now always visible

This commit is contained in:
Abdelilah El Aissaoui 2023-09-10 21:21:32 +02:00
parent 0a8c8ac1ed
commit 64f9953837
No known key found for this signature in database
GPG Key ID: 7587FC860F594869

View File

@ -27,7 +27,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.clipRect import androidx.compose.ui.graphics.drawscope.clipRect
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.input.key.onPreviewKeyEvent import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.ui.input.pointer.PointerIcon
import androidx.compose.ui.input.pointer.pointerHoverIcon import androidx.compose.ui.input.pointer.pointerHoverIcon
import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
@ -58,7 +57,6 @@ import kotlinx.coroutines.launch
import org.eclipse.jgit.lib.Ref import org.eclipse.jgit.lib.Ref
import org.eclipse.jgit.lib.RepositoryState import org.eclipse.jgit.lib.RepositoryState
import org.eclipse.jgit.revwalk.RevCommit import org.eclipse.jgit.revwalk.RevCommit
import java.awt.Cursor
private val colors = listOf( private val colors = listOf(
Color(0xFF42a5f5), Color(0xFF42a5f5),
@ -130,7 +128,6 @@ private fun LogLoaded(
repositoryState: RepositoryState repositoryState: RepositoryState
) { ) {
val scope = rememberCoroutineScope() val scope = rememberCoroutineScope()
val hasUncommittedChanges = logStatus.hasUncommittedChanges
val commitList = logStatus.plotCommitList val commitList = logStatus.plotCommitList
val verticalScrollState by logViewModel.verticalListState.collectAsState() val verticalScrollState by logViewModel.verticalListState.collectAsState()
val horizontalScrollState by logViewModel.horizontalListState.collectAsState() val horizontalScrollState by logViewModel.horizontalListState.collectAsState()
@ -219,8 +216,6 @@ private fun LogLoaded(
// a padding, so it doesn't cover the graph // a padding, so it doesn't cover the graph
MessagesList( MessagesList(
scrollState = verticalScrollState, scrollState = verticalScrollState,
horizontalScrollState = horizontalScrollState,
hasUncommittedChanges = hasUncommittedChanges,
searchFilter = if (searchFilterValue is LogSearch.SearchResults) searchFilterValue.commits else null, searchFilter = if (searchFilterValue is LogSearch.SearchResults) searchFilterValue.commits else null,
selectedCommit = selectedCommit, selectedCommit = selectedCommit,
logStatus = logStatus, logStatus = logStatus,
@ -228,7 +223,6 @@ private fun LogLoaded(
selectedItem = selectedItem, selectedItem = selectedItem,
commitList = commitList, commitList = commitList,
logViewModel = logViewModel, logViewModel = logViewModel,
graphWidth = graphWidth,
commitsLimit = logStatus.commitsLimit, commitsLimit = logStatus.commitsLimit,
onMerge = { ref -> onMerge = { ref ->
logViewModel.mergeBranch(ref) logViewModel.mergeBranch(ref)
@ -238,7 +232,9 @@ private fun LogLoaded(
}, },
onShowLogDialog = { dialog -> onShowLogDialog = { dialog ->
logViewModel.showDialog(dialog) logViewModel.showDialog(dialog)
} },
graphWidth = graphWidth,
horizontalScrollState = horizontalScrollState
) )
val density = LocalDensity.current.density val density = LocalDensity.current.density
@ -428,7 +424,6 @@ fun SearchFilter(
@Composable @Composable
fun MessagesList( fun MessagesList(
scrollState: LazyListState, scrollState: LazyListState,
hasUncommittedChanges: Boolean,
searchFilter: List<GraphNode>?, searchFilter: List<GraphNode>?,
selectedCommit: RevCommit?, selectedCommit: RevCommit?,
logStatus: LogStatus.Loaded, logStatus: LogStatus.Loaded,
@ -446,12 +441,6 @@ fun MessagesList(
ScrollableLazyColumn( ScrollableLazyColumn(
state = scrollState, state = scrollState,
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
) {
if (
hasUncommittedChanges ||
repositoryState.isMerging ||
repositoryState.isRebasing ||
repositoryState.isCherryPicking
) { ) {
item { item {
Box( Box(
@ -474,7 +463,6 @@ fun MessagesList(
) )
} }
} }
}
// Setting a key makes the graph preserve the scroll position when a new line has been added on top (uncommited changes) // Setting a key makes the graph preserve the scroll position when a new line has been added on top (uncommited changes)
// Therefore, after popping a stash, the uncommited changes wouldn't be visible and requires the user scrolling. // Therefore, after popping a stash, the uncommited changes wouldn't be visible and requires the user scrolling.