From 8f2598d866b6e598c4f88c5a5de5883b2565b58b Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Tue, 7 Jun 2022 20:10:30 +0200 Subject: [PATCH] Disabled creation of branches/tags/stashes with empty string on enter or whitespaces --- src/main/kotlin/app/ui/dialogs/NewBranchDialog.kt | 4 ++-- src/main/kotlin/app/ui/dialogs/NewTagDialog.kt | 4 ++-- src/main/kotlin/app/ui/dialogs/StashWithMessageDialog.kt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/app/ui/dialogs/NewBranchDialog.kt b/src/main/kotlin/app/ui/dialogs/NewBranchDialog.kt index 1c972e4..884ff41 100644 --- a/src/main/kotlin/app/ui/dialogs/NewBranchDialog.kt +++ b/src/main/kotlin/app/ui/dialogs/NewBranchDialog.kt @@ -44,7 +44,7 @@ fun NewBranchDialog( } .width(300.dp) .onPreviewKeyEvent { - if (it.key == Key.Enter) { + if (it.key == Key.Enter && branchField.isNotBlank()) { onAccept(branchField) true } else { @@ -79,7 +79,7 @@ fun NewBranchDialog( this.previous = branchFieldFocusRequester this.next = branchFieldFocusRequester }, - enabled = branchField.isNotEmpty(), + enabled = branchField.isNotBlank(), onClick = { onAccept(branchField) }, diff --git a/src/main/kotlin/app/ui/dialogs/NewTagDialog.kt b/src/main/kotlin/app/ui/dialogs/NewTagDialog.kt index 2d9d562..493552e 100644 --- a/src/main/kotlin/app/ui/dialogs/NewTagDialog.kt +++ b/src/main/kotlin/app/ui/dialogs/NewTagDialog.kt @@ -44,7 +44,7 @@ fun NewTagDialog( } .width(300.dp) .onPreviewKeyEvent { - if (it.key == Key.Enter) { + if (it.key == Key.Enter && tagField.isBlank()) { onAccept(tagField) true } else { @@ -79,7 +79,7 @@ fun NewTagDialog( this.previous = tagFieldFocusRequester this.next = tagFieldFocusRequester }, - enabled = tagField.isNotEmpty(), + enabled = tagField.isBlank(), onClick = { onAccept(tagField) }, diff --git a/src/main/kotlin/app/ui/dialogs/StashWithMessageDialog.kt b/src/main/kotlin/app/ui/dialogs/StashWithMessageDialog.kt index ef63820..0ce3d1c 100644 --- a/src/main/kotlin/app/ui/dialogs/StashWithMessageDialog.kt +++ b/src/main/kotlin/app/ui/dialogs/StashWithMessageDialog.kt @@ -44,7 +44,7 @@ fun StashWithMessageDialog( } .width(300.dp) .onPreviewKeyEvent { - if (it.key == Key.Enter) { + if (it.key == Key.Enter && textField.isNotBlank()) { onAccept(textField) true } else { @@ -78,7 +78,7 @@ fun StashWithMessageDialog( this.previous = textFieldFocusRequester this.next = textFieldFocusRequester }, - enabled = textField.isNotEmpty(), + enabled = textField.isNotBlank(), onClick = { onAccept(textField) },