Disabled commit with ctrl+enter if commtis conditions are not met
This commit is contained in:
parent
7b1a79e2cf
commit
2a8794d62d
@ -66,6 +66,7 @@ fun UncommitedChanges(
|
|||||||
onStagedDiffEntrySelected(null)
|
onStagedDiffEntrySelected(null)
|
||||||
commitMessage = ""
|
commitMessage = ""
|
||||||
}
|
}
|
||||||
|
val canCommit = commitMessage.isNotEmpty() && staged.isNotEmpty()
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
@ -136,7 +137,7 @@ fun UncommitedChanges(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.weight(weight = 1f, fill = true)
|
.weight(weight = 1f, fill = true)
|
||||||
.onPreviewKeyEvent {
|
.onPreviewKeyEvent {
|
||||||
if (it.isCtrlPressed && it.key == Key.Enter) {
|
if (it.isCtrlPressed && it.key == Key.Enter && canCommit) {
|
||||||
doCommit()
|
doCommit()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
@ -157,7 +158,7 @@ fun UncommitedChanges(
|
|||||||
onClick = {
|
onClick = {
|
||||||
doCommit()
|
doCommit()
|
||||||
},
|
},
|
||||||
enabled = commitMessage.isNotEmpty() && staged.isNotEmpty(),
|
enabled = canCommit,
|
||||||
shape = RectangleShape,
|
shape = RectangleShape,
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
|
Loading…
Reference in New Issue
Block a user