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.vector.ImageVector
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.platform.LocalDensity
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.RepositoryState
import org.eclipse.jgit.revwalk.RevCommit
import java.awt.Cursor
private val colors = listOf(
Color(0xFF42a5f5),
@ -130,7 +128,6 @@ private fun LogLoaded(
repositoryState: RepositoryState
) {
val scope = rememberCoroutineScope()
val hasUncommittedChanges = logStatus.hasUncommittedChanges
val commitList = logStatus.plotCommitList
val verticalScrollState by logViewModel.verticalListState.collectAsState()
val horizontalScrollState by logViewModel.horizontalListState.collectAsState()
@ -219,8 +216,6 @@ private fun LogLoaded(
// a padding, so it doesn't cover the graph
MessagesList(
scrollState = verticalScrollState,
horizontalScrollState = horizontalScrollState,
hasUncommittedChanges = hasUncommittedChanges,
searchFilter = if (searchFilterValue is LogSearch.SearchResults) searchFilterValue.commits else null,
selectedCommit = selectedCommit,
logStatus = logStatus,
@ -228,7 +223,6 @@ private fun LogLoaded(
selectedItem = selectedItem,
commitList = commitList,
logViewModel = logViewModel,
graphWidth = graphWidth,
commitsLimit = logStatus.commitsLimit,
onMerge = { ref ->
logViewModel.mergeBranch(ref)
@ -238,7 +232,9 @@ private fun LogLoaded(
},
onShowLogDialog = { dialog ->
logViewModel.showDialog(dialog)
}
},
graphWidth = graphWidth,
horizontalScrollState = horizontalScrollState
)
val density = LocalDensity.current.density
@ -428,7 +424,6 @@ fun SearchFilter(
@Composable
fun MessagesList(
scrollState: LazyListState,
hasUncommittedChanges: Boolean,
searchFilter: List<GraphNode>?,
selectedCommit: RevCommit?,
logStatus: LogStatus.Loaded,
@ -446,12 +441,6 @@ fun MessagesList(
ScrollableLazyColumn(
state = scrollState,
modifier = Modifier.fillMaxSize(),
) {
if (
hasUncommittedChanges ||
repositoryState.isMerging ||
repositoryState.isRebasing ||
repositoryState.isCherryPicking
) {
item {
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)
// Therefore, after popping a stash, the uncommited changes wouldn't be visible and requires the user scrolling.