@@ -46,9 +46,13 @@ impl Component for TagCommitPopup {
46
46
if self . is_visible ( ) || force_all {
47
47
self . input . commands ( out, force_all) ;
48
48
49
+ let is_annotation_mode =
50
+ matches ! ( self . mode, Mode :: Annotation { .. } ) ;
51
+
49
52
out. push ( CommandInfo :: new (
50
53
strings:: commands:: tag_commit_confirm_msg (
51
54
& self . key_config ,
55
+ is_annotation_mode,
52
56
) ,
53
57
self . is_valid_tag ( ) ,
54
58
true ,
@@ -67,29 +71,27 @@ impl Component for TagCommitPopup {
67
71
fn event ( & mut self , ev : & Event ) -> Result < EventState > {
68
72
if self . is_visible ( ) {
69
73
if let Event :: Key ( e) = ev {
70
- 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 )
71
79
&& self . is_valid_tag ( )
72
80
{
73
81
try_or_popup ! ( self , "tag error:" , self . tag( ) ) ;
74
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 ) ;
75
89
} else if key_match (
76
90
e,
77
91
self . key_config . keys . tag_annotate ,
78
92
) && self . is_valid_tag ( )
79
93
{
80
- let tag_name: String =
81
- self . input . get_text ( ) . into ( ) ;
82
-
83
- self . input . clear ( ) ;
84
- self . input . set_title (
85
- strings:: tag_popup_annotation_title (
86
- & tag_name,
87
- ) ,
88
- ) ;
89
- self . input . set_default_msg (
90
- strings:: tag_popup_annotation_msg ( ) ,
91
- ) ;
92
- self . mode = Mode :: Annotation { tag_name } ;
94
+ self . start_annotate_mode ( ) ;
93
95
return Ok ( EventState :: Consumed ) ;
94
96
}
95
97
}
@@ -110,6 +112,7 @@ impl Component for TagCommitPopup {
110
112
111
113
fn show ( & mut self ) -> Result < ( ) > {
112
114
self . mode = Mode :: Name ;
115
+ self . input . set_input_type ( InputType :: Singleline ) ;
113
116
self . input . set_title ( strings:: tag_popup_name_title ( ) ) ;
114
117
self . input . set_default_msg ( strings:: tag_popup_name_msg ( ) ) ;
115
118
self . input . show ( ) ?;
@@ -165,6 +168,7 @@ impl TagCommitPopup {
165
168
. flatten ( )
166
169
. and_then ( |val| val. parse :: < bool > ( ) . ok ( ) )
167
170
. unwrap_or_default ( ) ;
171
+
168
172
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." ) ;
169
173
170
174
let ( tag_name, tag_annotation) = self . tag_info ( ) ;
@@ -200,4 +204,17 @@ impl TagCommitPopup {
200
204
201
205
Ok ( ( ) )
202
206
}
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
+ }
203
220
}
0 commit comments