@@ -394,20 +394,27 @@ impl Component for StatusTreeComponent {
394394 out : & mut Vec < CommandInfo > ,
395395 force_all : bool ,
396396 ) -> CommandBlocking {
397+ let available = self . focused || force_all;
398+ let selection = self . selection_file ( ) ;
399+ let selected_is_file = selection. is_some ( ) ;
400+ let tracked = selection. is_some_and ( |s| {
401+ !matches ! ( s. status, StatusItemType :: New )
402+ } ) ;
403+
397404 out. push (
398405 CommandInfo :: new (
399406 strings:: commands:: navigate_tree ( & self . key_config ) ,
400407 !self . is_empty ( ) ,
401- self . focused || force_all ,
408+ available ,
402409 )
403410 . order ( order:: NAV ) ,
404411 ) ;
405412
406413 out. push (
407414 CommandInfo :: new (
408415 strings:: commands:: blame_file ( & self . key_config ) ,
409- self . selection_file ( ) . is_some ( ) ,
410- self . focused || force_all ,
416+ selected_is_file && tracked ,
417+ available ,
411418 )
412419 . order ( order:: RARE_ACTION ) ,
413420 ) ;
@@ -417,26 +424,26 @@ impl Component for StatusTreeComponent {
417424 strings:: commands:: open_file_history (
418425 & self . key_config ,
419426 ) ,
420- self . selection_file ( ) . is_some ( ) ,
421- self . focused || force_all ,
427+ selected_is_file && tracked ,
428+ available ,
422429 )
423430 . order ( order:: RARE_ACTION ) ,
424431 ) ;
425432
426433 out. push (
427434 CommandInfo :: new (
428435 strings:: commands:: edit_item ( & self . key_config ) ,
429- self . selection_file ( ) . is_some ( ) ,
430- self . focused || force_all ,
436+ selected_is_file ,
437+ available ,
431438 )
432439 . order ( order:: RARE_ACTION ) ,
433440 ) ;
434441
435442 out. push (
436443 CommandInfo :: new (
437444 strings:: commands:: copy_path ( & self . key_config ) ,
438- self . selection_file ( ) . is_some ( ) ,
439- self . focused || force_all ,
445+ selected_is_file ,
446+ available ,
440447 )
441448 . order ( order:: RARE_ACTION ) ,
442449 ) ;
@@ -448,30 +455,53 @@ impl Component for StatusTreeComponent {
448455 if self . focused {
449456 if let Event :: Key ( e) = ev {
450457 return if key_match ( e, self . key_config . keys . blame ) {
451- if let Some ( status_item) = self . selection_file ( ) {
452- self . hide ( ) ;
453- self . queue . push ( InternalEvent :: OpenPopup (
454- StackablePopupOpen :: BlameFile (
455- BlameFileOpen {
456- file_path : status_item. path ,
457- commit_id : self . revision ,
458- selection : None ,
459- } ,
460- ) ,
461- ) ) ;
458+ match self . selection_file ( ) {
459+ Some ( status_item)
460+ if !matches ! (
461+ status_item. status,
462+ StatusItemType :: New
463+ ) =>
464+ {
465+ self . hide ( ) ;
466+ self . queue . push (
467+ InternalEvent :: OpenPopup (
468+ StackablePopupOpen :: BlameFile (
469+ BlameFileOpen {
470+ file_path : status_item
471+ . path ,
472+ commit_id : self . revision ,
473+ selection : None ,
474+ } ,
475+ ) ,
476+ ) ,
477+ ) ;
478+ }
479+ _ => { }
462480 }
463481 Ok ( EventState :: Consumed )
464482 } else if key_match (
465483 e,
466484 self . key_config . keys . file_history ,
467485 ) {
468- if let Some ( status_item) = self . selection_file ( ) {
469- self . hide ( ) ;
470- self . queue . push ( InternalEvent :: OpenPopup (
471- StackablePopupOpen :: FileRevlog (
472- FileRevOpen :: new ( status_item. path ) ,
473- ) ,
474- ) ) ;
486+ match self . selection_file ( ) {
487+ Some ( status_item)
488+ if !matches ! (
489+ status_item. status,
490+ StatusItemType :: New
491+ ) =>
492+ {
493+ self . hide ( ) ;
494+ self . queue . push (
495+ InternalEvent :: OpenPopup (
496+ StackablePopupOpen :: FileRevlog (
497+ FileRevOpen :: new (
498+ status_item. path ,
499+ ) ,
500+ ) ,
501+ ) ,
502+ ) ;
503+ }
504+ _ => { }
475505 }
476506 Ok ( EventState :: Consumed )
477507 } else if key_match ( e, self . key_config . keys . edit_file )
0 commit comments