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