@@ -14,7 +14,7 @@ use anyhow::Result;
14
14
use asyncgit:: {
15
15
sync:: {
16
16
self , branch:: checkout_remote_branch, checkout_branch,
17
- get_branches_info, BranchInfo ,
17
+ get_branches_info, BranchInfo , CommitId ,
18
18
} ,
19
19
AsyncGitNotification , CWD ,
20
20
} ;
@@ -118,6 +118,14 @@ impl Component for BranchListComponent {
118
118
true ,
119
119
) ) ;
120
120
121
+ out. push ( CommandInfo :: new (
122
+ strings:: commands:: commit_details_open (
123
+ & self . key_config ,
124
+ ) ,
125
+ true ,
126
+ true ,
127
+ ) ) ;
128
+
121
129
out. push ( CommandInfo :: new (
122
130
strings:: commands:: toggle_branch_popup (
123
131
& self . key_config ,
@@ -192,6 +200,9 @@ impl Component for BranchListComponent {
192
200
return self
193
201
. move_selection ( ScrollType :: PageUp )
194
202
. map ( Into :: into) ;
203
+ } else if e == self . key_config . tab_toggle {
204
+ self . local = !self . local ;
205
+ self . update_branches ( ) ?;
195
206
} else if e == self . key_config . enter {
196
207
try_or_popup ! (
197
208
self ,
@@ -234,13 +245,18 @@ impl Component for BranchListComponent {
234
245
"merge branch error:" ,
235
246
self . merge_branch( )
236
247
) ;
237
- self . hide ( ) ;
238
248
self . queue . push ( InternalEvent :: Update (
239
249
NeedsUpdate :: ALL ,
240
250
) ) ;
241
- } else if e == self . key_config . tab_toggle {
242
- self . local = !self . local ;
243
- self . update_branches ( ) ?;
251
+ } else if e == self . key_config . move_right
252
+ && self . valid_selection ( )
253
+ {
254
+ self . hide ( ) ;
255
+ if let Some ( b) = self . get_selected ( ) {
256
+ self . queue . push (
257
+ InternalEvent :: InspectCommit ( b, None ) ,
258
+ ) ;
259
+ }
244
260
}
245
261
}
246
262
@@ -351,6 +367,12 @@ impl BranchListComponent {
351
367
. count ( ) > 0
352
368
}
353
369
370
+ fn get_selected ( & self ) -> Option < CommitId > {
371
+ self . branches
372
+ . get ( usize:: from ( self . selection ) )
373
+ . map ( |b| b. top_commit )
374
+ }
375
+
354
376
///
355
377
fn move_selection ( & mut self , scroll : ScrollType ) -> Result < bool > {
356
378
let new_selection = match scroll {
0 commit comments