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