File tree Expand file tree Collapse file tree 4 files changed +23
-5
lines changed Expand file tree Collapse file tree 4 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,11 @@ impl CommitComponent {
80
80
pub fn new ( queue : Queue , theme : & Theme ) -> Self {
81
81
Self {
82
82
queue,
83
- input : TextInputComponent :: new ( theme) ,
83
+ input : TextInputComponent :: new (
84
+ theme,
85
+ strings:: COMMIT_TITLE ,
86
+ strings:: COMMIT_MSG ,
87
+ ) ,
84
88
}
85
89
}
86
90
Original file line number Diff line number Diff line change @@ -96,7 +96,11 @@ impl StashMsgComponent {
96
96
Self {
97
97
options : StashingOptions :: default ( ) ,
98
98
queue,
99
- input : TextInputComponent :: new ( theme) ,
99
+ input : TextInputComponent :: new (
100
+ theme,
101
+ strings:: STASH_POPUP_TITLE ,
102
+ strings:: STASH_POPUP_MSG ,
103
+ ) ,
100
104
}
101
105
}
102
106
}
Original file line number Diff line number Diff line change @@ -18,18 +18,26 @@ use tui::{
18
18
19
19
/// primarily a subcomponet for user input of text (used in `CommitComponent`)
20
20
pub struct TextInputComponent {
21
+ title : String ,
22
+ default_msg : String ,
21
23
msg : String ,
22
24
visible : bool ,
23
25
theme : Theme ,
24
26
}
25
27
26
28
impl TextInputComponent {
27
29
///
28
- pub fn new ( theme : & Theme ) -> Self {
30
+ pub fn new (
31
+ theme : & Theme ,
32
+ title : & str ,
33
+ default_msg : & str ,
34
+ ) -> Self {
29
35
Self {
30
36
msg : String :: default ( ) ,
31
37
visible : false ,
32
38
theme : * theme,
39
+ title : title. to_string ( ) ,
40
+ default_msg : default_msg. to_string ( ) ,
33
41
}
34
42
}
35
43
@@ -49,7 +57,7 @@ impl DrawableComponent for TextInputComponent {
49
57
if self . visible {
50
58
let txt = if self . msg . is_empty ( ) {
51
59
[ Text :: Styled (
52
- Cow :: from ( strings :: COMMIT_MSG ) ,
60
+ Cow :: from ( self . default_msg . as_str ( ) ) ,
53
61
self . theme . text ( false , false ) ,
54
62
) ]
55
63
} else {
@@ -62,7 +70,7 @@ impl DrawableComponent for TextInputComponent {
62
70
let area = ui:: centered_rect ( 60 , 20 , f. size ( ) ) ;
63
71
f. render_widget ( Clear , area) ;
64
72
f. render_widget (
65
- dialog_paragraph ( strings :: COMMIT_TITLE , txt. iter ( ) ) ,
73
+ dialog_paragraph ( self . title . as_str ( ) , txt. iter ( ) ) ,
66
74
area,
67
75
) ;
68
76
}
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ pub static CMD_SPLITTER: &str = " ";
12
12
pub static MSG_TITLE_ERROR : & str = "Error" ;
13
13
pub static COMMIT_TITLE : & str = "Commit" ;
14
14
pub static COMMIT_MSG : & str = "type commit message.." ;
15
+ pub static STASH_POPUP_TITLE : & str = "Stash" ;
16
+ pub static STASH_POPUP_MSG : & str = "type name (optional)" ;
15
17
pub static RESET_TITLE : & str = "Reset" ;
16
18
pub static RESET_MSG : & str = "confirm file reset?" ;
17
19
You can’t perform that action at this time.
0 commit comments