Disabled fixup and squash for the first line of the rebase interactive

This commit is contained in:
Abdelilah El Aissaoui 2022-05-27 13:30:07 +02:00
parent 332c3ef73d
commit f124d1fb9e

View file

@ -66,10 +66,12 @@ fun RebaseStateLoaded(
)
ScrollableLazyColumn(modifier = Modifier.weight(1f)) {
items(rebaseState.stepsList) { rebaseTodoLine ->
val stepsList = rebaseState.stepsList
items(stepsList) { rebaseTodoLine ->
RebaseCommit(
rebaseLine = rebaseTodoLine,
message = rebaseState.messages[rebaseTodoLine.commit.name()],
isFirst = stepsList.first() == rebaseTodoLine,
onActionChanged = { newAction ->
rebaseInteractiveViewModel.onCommitActionChanged(rebaseTodoLine.commit, newAction)
},
@ -104,6 +106,7 @@ fun RebaseStateLoaded(
@Composable
fun RebaseCommit(
rebaseLine: RebaseTodoLine,
isFirst: Boolean,
message: String?,
onActionChanged: (Action) -> Unit,
onMessageChanged: (String) -> Unit,
@ -122,6 +125,7 @@ fun RebaseCommit(
) {
ActionDropdown(
rebaseLine.action,
isFirst = isFirst,
onActionChanged = onActionChanged,
)
@ -146,6 +150,7 @@ fun RebaseCommit(
@Composable
fun ActionDropdown(
action: Action,
isFirst: Boolean,
onActionChanged: (Action) -> Unit,
) {
var showDropDownMenu by remember { mutableStateOf(false) }
@ -162,7 +167,13 @@ fun ActionDropdown(
expanded = showDropDownMenu,
onDismissRequest = { showDropDownMenu = false },
) {
for (dropDownOption in actions) {
val dropDownItems = if (isFirst) {
firstItemActions
} else {
actions
}
for (dropDownOption in dropDownItems) {
DropdownMenuItem(
onClick = {
showDropDownMenu = false
@ -176,6 +187,11 @@ fun ActionDropdown(
}
}
val firstItemActions = listOf(
Action.PICK,
Action.REWORD,
)
val actions = listOf(
Action.PICK,
Action.REWORD,