Fixed rebase interactive text field losing focus on new line

This commit is contained in:
Abdelilah El Aissaoui 2023-09-21 23:01:45 +02:00
parent 9c2cb8ead4
commit 178f3f424e
No known key found for this signature in database
GPG Key ID: 7587FC860F594869

View File

@ -37,7 +37,7 @@ fun RebaseInteractive(
) { ) {
val rebaseState = rebaseInteractiveViewModel.rebaseState.collectAsState() val rebaseState = rebaseInteractiveViewModel.rebaseState.collectAsState()
val rebaseStateValue = rebaseState.value val rebaseStateValue = rebaseState.value
val selectedItem by rebaseInteractiveViewModel.selectedItem.collectAsState() val selectedItem = rebaseInteractiveViewModel.selectedItem.collectAsState().value
LaunchedEffect(rebaseInteractiveViewModel) { LaunchedEffect(rebaseInteractiveViewModel) {
rebaseInteractiveViewModel.loadRebaseInteractiveData() rebaseInteractiveViewModel.loadRebaseInteractiveData()
@ -56,7 +56,12 @@ fun RebaseInteractive(
rebaseStateValue, rebaseStateValue,
selectedItem, selectedItem,
onFocusLine = { onFocusLine = {
if (
selectedItem !is SelectedItem.Commit ||
!selectedItem.revCommit.id.startsWith(it.commit)
) {
rebaseInteractiveViewModel.selectLine(it) rebaseInteractiveViewModel.selectLine(it)
}
}, },
onCancel = { onCancel = {
rebaseInteractiveViewModel.cancel() rebaseInteractiveViewModel.cancel()
@ -98,7 +103,7 @@ fun RebaseStateLoaded(
modifier = Modifier modifier = Modifier
.weight(1f) .weight(1f)
) { ) {
items(stepsList) { rebaseTodoLine -> items(stepsList, key = { it.commit }) { rebaseTodoLine ->
RebaseCommit( RebaseCommit(
rebaseLine = rebaseTodoLine, rebaseLine = rebaseTodoLine,
message = rebaseState.messages[rebaseTodoLine.commit.name()], message = rebaseState.messages[rebaseTodoLine.commit.name()],