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