@@ -576,18 +576,36 @@ impl ConventionalCommitPopup {
576
576
}
577
577
578
578
fn validate_escape ( & mut self , commit_type : CommitType ) {
579
- let ( emoji, short_msg, _) = self . query_results_more_info
580
- [ self . selected_index ]
581
- . strings ( ) ;
582
- self . queue . push ( crate :: queue:: InternalEvent :: OpenCommit ) ;
583
- self . queue . push (
584
- crate :: queue:: InternalEvent :: AddCommitMessage ( format ! (
585
- "{emoji} {commit_type}{}{} {short_msg}" ,
586
- if self . is_breaking { "!" } else { "" } ,
587
- if short_msg. is_empty( ) { "" } else { ":" } ,
588
- ) ) ,
589
- ) ;
590
- self . hide ( ) ;
579
+ #[ cfg( not( feature = "gitmoji" ) ) ]
580
+ {
581
+ self . queue . push ( crate :: queue:: InternalEvent :: OpenCommit ) ;
582
+ self . queue . push (
583
+ crate :: queue:: InternalEvent :: AddCommitMessage (
584
+ format ! (
585
+ "{commit_type}{}:" ,
586
+ if self . is_breaking { "!" } else { "" } ,
587
+ ) ,
588
+ ) ,
589
+ ) ;
590
+ self . hide ( ) ;
591
+ }
592
+ #[ cfg( feature = "gitmoji" ) ]
593
+ {
594
+ let ( emoji, short_msg, _) = self . query_results_more_info
595
+ [ self . selected_index ]
596
+ . strings ( ) ;
597
+ self . queue . push ( crate :: queue:: InternalEvent :: OpenCommit ) ;
598
+ self . queue . push (
599
+ crate :: queue:: InternalEvent :: AddCommitMessage (
600
+ format ! (
601
+ "{emoji} {commit_type}{}{} {short_msg}" ,
602
+ if self . is_breaking { "!" } else { "" } ,
603
+ if short_msg. is_empty( ) { "" } else { ":" } ,
604
+ ) ,
605
+ ) ,
606
+ ) ;
607
+ self . hide ( ) ;
608
+ }
591
609
}
592
610
593
611
fn next_step ( & mut self ) {
@@ -725,14 +743,22 @@ impl Component for ConventionalCommitPopup {
725
743
self . seleted_commit_type
726
744
{
727
745
self . validate_escape ( commit_type) ;
728
- } else if let Some ( & commit) = self
729
- . query_results_type
730
- . get ( self . selected_index )
731
- {
732
- self . seleted_commit_type = Some ( commit) ;
733
- self . next_step ( ) ;
734
-
735
- if commit. more_info ( ) . len ( ) == 1 {
746
+ } else {
747
+ if let Some ( & commit) = self
748
+ . query_results_type
749
+ . get ( self . selected_index )
750
+ {
751
+ self . seleted_commit_type = Some ( commit) ;
752
+
753
+ #[ cfg( feature = "gitmoji" ) ]
754
+ {
755
+ self . next_step ( ) ;
756
+
757
+ if commit. more_info ( ) . len ( ) == 1 {
758
+ self . validate_escape ( commit) ;
759
+ }
760
+ }
761
+ #[ cfg( not( feature = "gitmoji" ) ) ]
736
762
self . validate_escape ( commit) ;
737
763
}
738
764
}
0 commit comments