Fixed commit msg not cleared after commit

This commit is contained in:
Abdelilah El Aissaoui 2021-12-04 06:50:41 +01:00
parent 48b51b3796
commit 7b1a79e2cf

View File

@ -61,6 +61,11 @@ fun UncommitedChanges(
}
var commitMessage by remember { mutableStateOf("") }
val doCommit = {
gitManager.commit(commitMessage)
onStagedDiffEntrySelected(null)
commitMessage = ""
}
Column {
AnimatedVisibility(
@ -132,7 +137,7 @@ fun UncommitedChanges(
.weight(weight = 1f, fill = true)
.onPreviewKeyEvent {
if (it.isCtrlPressed && it.key == Key.Enter) {
gitManager.commit(commitMessage)
doCommit()
true
}
else
@ -150,9 +155,7 @@ fun UncommitedChanges(
modifier = Modifier
.fillMaxWidth(),
onClick = {
gitManager.commit(commitMessage)
commitMessage = ""
onStagedDiffEntrySelected(null)
doCommit()
},
enabled = commitMessage.isNotEmpty() && staged.isNotEmpty(),
shape = RectangleShape,