@@ -46,9 +46,13 @@ impl Component for TagCommitPopup {
4646 if self . is_visible ( ) || force_all {
4747 self . input . commands ( out, force_all) ;
4848
49+ let is_annotation_mode =
50+ matches ! ( self . mode, Mode :: Annotation { .. } ) ;
51+
4952 out. push ( CommandInfo :: new (
5053 strings:: commands:: tag_commit_confirm_msg (
5154 & self . key_config ,
55+ is_annotation_mode,
5256 ) ,
5357 self . is_valid_tag ( ) ,
5458 true ,
@@ -66,37 +70,34 @@ impl Component for TagCommitPopup {
6670
6771 fn event ( & mut self , ev : & Event ) -> Result < EventState > {
6872 if self . is_visible ( ) {
69- if self . input . event ( ev) ?. is_consumed ( ) {
70- return Ok ( EventState :: Consumed ) ;
71- }
72-
7373 if let Event :: Key ( e) = ev {
74- if key_match ( e, self . key_config . keys . enter )
74+ let is_annotation_mode =
75+ matches ! ( self . mode, Mode :: Annotation { .. } ) ;
76+
77+ if !is_annotation_mode
78+ && key_match ( e, self . key_config . keys . enter )
7579 && self . is_valid_tag ( )
7680 {
7781 try_or_popup ! ( self , "tag error:" , self . tag( ) ) ;
82+ return Ok ( EventState :: Consumed ) ;
83+ }
84+ if is_annotation_mode
85+ && key_match ( e, self . key_config . keys . commit )
86+ {
87+ try_or_popup ! ( self , "tag error:" , self . tag( ) ) ;
88+ return Ok ( EventState :: Consumed ) ;
7889 } else if key_match (
7990 e,
8091 self . key_config . keys . tag_annotate ,
8192 ) && self . is_valid_tag ( )
8293 {
83- let tag_name: String =
84- self . input . get_text ( ) . into ( ) ;
85-
86- self . input . clear ( ) ;
87- self . input . set_title (
88- strings:: tag_popup_annotation_title (
89- & tag_name,
90- ) ,
91- ) ;
92- self . input . set_default_msg (
93- strings:: tag_popup_annotation_msg ( ) ,
94- ) ;
95- self . mode = Mode :: Annotation { tag_name } ;
94+ self . start_annotate_mode ( ) ;
95+ return Ok ( EventState :: Consumed ) ;
9696 }
97-
98- return Ok ( EventState :: Consumed ) ;
9997 }
98+
99+ self . input . event ( ev) ?;
100+ return Ok ( EventState :: Consumed ) ;
100101 }
101102 Ok ( EventState :: NotConsumed )
102103 }
@@ -111,6 +112,7 @@ impl Component for TagCommitPopup {
111112
112113 fn show ( & mut self ) -> Result < ( ) > {
113114 self . mode = Mode :: Name ;
115+ self . input . set_input_type ( InputType :: Singleline ) ;
114116 self . input . set_title ( strings:: tag_popup_name_title ( ) ) ;
115117 self . input . set_default_msg ( strings:: tag_popup_name_msg ( ) ) ;
116118 self . input . show ( ) ?;
@@ -166,6 +168,7 @@ impl TagCommitPopup {
166168 . flatten ( )
167169 . and_then ( |val| val. parse :: < bool > ( ) . ok ( ) )
168170 . unwrap_or_default ( ) ;
171+
169172 anyhow:: ensure!( !gpgsign, "config tag.gpgsign=true detected.\n gpg signing not supported.\n deactivate in your repo/gitconfig to be able to tag without signing." ) ;
170173
171174 let ( tag_name, tag_annotation) = self . tag_info ( ) ;
@@ -201,4 +204,17 @@ impl TagCommitPopup {
201204
202205 Ok ( ( ) )
203206 }
207+
208+ fn start_annotate_mode ( & mut self ) {
209+ let tag_name: String = self . input . get_text ( ) . into ( ) ;
210+
211+ self . input . clear ( ) ;
212+ self . input . set_input_type ( InputType :: Multiline ) ;
213+ self . input . set_title ( strings:: tag_popup_annotation_title (
214+ & tag_name,
215+ ) ) ;
216+ self . input
217+ . set_default_msg ( strings:: tag_popup_annotation_msg ( ) ) ;
218+ self . mode = Mode :: Annotation { tag_name } ;
219+ }
204220}
0 commit comments