@@ -29,7 +29,7 @@ pub struct FloatingText {
29
29
max_line_width : usize ,
30
30
v_scroll : usize ,
31
31
h_scroll : usize ,
32
- mode_title : String ,
32
+ title : String ,
33
33
}
34
34
35
35
macro_rules! style {
@@ -124,7 +124,7 @@ fn get_lines_owned(s: &str) -> Vec<String> {
124
124
}
125
125
126
126
impl FloatingText {
127
- pub fn new ( text : String , title : & str ) -> Self {
127
+ pub fn new ( text : String , title : String ) -> Self {
128
128
let src = get_lines ( & text)
129
129
. into_iter ( )
130
130
. map ( |s| s. to_string ( ) )
@@ -133,7 +133,7 @@ impl FloatingText {
133
133
let max_line_width = max_width ! ( src) ;
134
134
Self {
135
135
src,
136
- mode_title : title. to_string ( ) ,
136
+ title,
137
137
max_line_width,
138
138
v_scroll : 0 ,
139
139
h_scroll : 0 ,
@@ -146,6 +146,7 @@ impl FloatingText {
146
146
// just apply highlights directly
147
147
( max_width ! ( get_lines( cmd) ) , Some ( cmd. clone ( ) ) )
148
148
}
149
+
149
150
Command :: LocalFile { file, .. } => {
150
151
// have to read from tmp dir to get cmd src
151
152
let raw = std:: fs:: read_to_string ( file)
@@ -163,7 +164,7 @@ impl FloatingText {
163
164
164
165
Some ( Self {
165
166
src,
166
- mode_title : title,
167
+ title,
167
168
max_line_width,
168
169
h_scroll : 0 ,
169
170
v_scroll : 0 ,
@@ -197,10 +198,12 @@ impl FloatingText {
197
198
198
199
impl FloatContent for FloatingText {
199
200
fn top_title ( & self ) -> Option < Line < ' _ > > {
200
- let title_text = format ! ( " {} " , self . mode_title) ;
201
+ let title_text = format ! ( " {} " , self . title) ;
202
+
201
203
let title_line = Line :: from ( title_text)
202
204
. centered ( )
203
205
. style ( Style :: default ( ) . reversed ( ) ) ;
206
+
204
207
Some ( title_line)
205
208
}
206
209
@@ -274,7 +277,7 @@ impl FloatContent for FloatingText {
274
277
275
278
fn get_shortcut_list ( & self ) -> ( & str , Box < [ Shortcut ] > ) {
276
279
(
277
- & self . mode_title ,
280
+ & self . title ,
278
281
Box :: new ( [
279
282
Shortcut :: new ( "Scroll down" , [ "j" , "Down" ] ) ,
280
283
Shortcut :: new ( "Scroll up" , [ "k" , "Up" ] ) ,
0 commit comments