Revert "Uncommited changes line is now always visible"
This reverts commit 64f9953837
.
This commit is contained in:
parent
5f2180f1a3
commit
a70adb6ad5
@ -27,6 +27,7 @@ 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
|
||||||
@ -57,6 +58,7 @@ 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),
|
||||||
@ -128,6 +130,7 @@ 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()
|
||||||
@ -216,6 +219,8 @@ 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,
|
||||||
@ -223,6 +228,7 @@ 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)
|
||||||
@ -232,9 +238,7 @@ 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
|
||||||
@ -424,6 +428,7 @@ 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,
|
||||||
@ -441,6 +446,12 @@ 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(
|
||||||
@ -463,6 +474,7 @@ 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user