@@ -130,17 +130,30 @@ impl RevisionFilesComponent {
130
130
}
131
131
132
132
fn blame ( & self ) -> bool {
133
- self . tree . selected_file ( ) . map_or ( false , |file| {
134
- self . queue . push ( InternalEvent :: BlameFile (
135
- file. full_path_str ( )
136
- . strip_prefix ( "./" )
137
- . unwrap_or_default ( )
138
- . to_string ( ) ,
139
- ) ) ;
133
+ self . selected_file_path ( ) . map_or ( false , |path| {
134
+ self . queue . push ( InternalEvent :: BlameFile ( path) ) ;
135
+
136
+ true
137
+ } )
138
+ }
139
+
140
+ fn file_history ( & self ) -> bool {
141
+ self . selected_file_path ( ) . map_or ( false , |path| {
142
+ self . queue . push ( InternalEvent :: OpenFileRevlog ( path) ) ;
143
+
140
144
true
141
145
} )
142
146
}
143
147
148
+ fn selected_file_path ( & self ) -> Option < String > {
149
+ self . tree . selected_file ( ) . map ( |file| {
150
+ file. full_path_str ( )
151
+ . strip_prefix ( "./" )
152
+ . unwrap_or_default ( )
153
+ . to_string ( )
154
+ } )
155
+ }
156
+
144
157
fn selection_changed ( & mut self ) {
145
158
//TODO: retrieve TreeFile from tree datastructure
146
159
if let Some ( file) = self
@@ -254,6 +267,16 @@ impl Component for RevisionFilesComponent {
254
267
)
255
268
. order ( order:: NAV ) ,
256
269
) ;
270
+ out. push (
271
+ CommandInfo :: new (
272
+ strings:: commands:: open_file_history (
273
+ & self . key_config ,
274
+ ) ,
275
+ self . tree . selected_file ( ) . is_some ( ) ,
276
+ true ,
277
+ )
278
+ . order ( order:: RARE_ACTION ) ,
279
+ ) ;
257
280
tree_nav_cmds ( & self . tree , & self . key_config , out) ;
258
281
} else {
259
282
self . current_file . commands ( out, force_all) ;
@@ -278,6 +301,11 @@ impl Component for RevisionFilesComponent {
278
301
self . hide ( ) ;
279
302
return Ok ( EventState :: Consumed ) ;
280
303
}
304
+ } else if key == self . key_config . file_history {
305
+ if self . file_history ( ) {
306
+ self . hide ( ) ;
307
+ return Ok ( EventState :: Consumed ) ;
308
+ }
281
309
} else if key == self . key_config . move_right {
282
310
if is_tree_focused {
283
311
self . focus = Focus :: File ;
0 commit comments