Added scroll to rebase interactive dialog

This commit is contained in:
Abdelilah El Aissaoui 2022-04-16 04:59:03 +02:00
parent f60580750b
commit 08f814c8d8
2 changed files with 4 additions and 5 deletions

View File

@ -14,6 +14,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import app.theme.primaryTextColor
import app.ui.components.PrimaryButton
import app.ui.components.ScrollableLazyColumn
import app.viewmodels.RebaseInteractiveState
import app.viewmodels.RebaseInteractiveViewModel
import org.eclipse.jgit.lib.RebaseTodoLine
@ -75,7 +76,7 @@ fun RebaseStateLoaded(
modifier = Modifier.padding(all = 16.dp)
)
LazyColumn(modifier = Modifier.weight(1f)) {
ScrollableLazyColumn(modifier = Modifier.weight(1f)) {
items(rebaseState.stepsList) { rebaseTodoLine ->
RebaseCommit(
rebaseLine = rebaseTodoLine,

View File

@ -61,9 +61,6 @@ class RebaseInteractiveViewModel @Inject constructor(
git = git,
interactiveHandler = object : InteractiveHandler {
override fun prepareSteps(steps: MutableList<RebaseTodoLine>?) {
for (step in steps ?: emptyList()) {
val foundStep = newSteps.firstOrNull { it.commit.name() == step.commit.name() }
@ -74,7 +71,8 @@ class RebaseInteractiveViewModel @Inject constructor(
}
override fun modifyCommitMessage(commit: String): String {
val step = rewordSteps.removeLast()
// This can be called when there aren't any reword steps if squash is used.
val step = rewordSteps.removeLastOrNull() ?: return commit
return rebaseState.messages[step.commit.name()]
?: throw InvalidMessageException("Message for commit $commit is unexpectedly null")