@@ -20,7 +20,8 @@ use crate::{
2020 options:: { Options , SharedOptions } ,
2121 popup_stack:: PopupStack ,
2222 queue:: {
23- Action , InternalEvent , NeedsUpdate , Queue , StackablePopupOpen ,
23+ Action , AppTabs , InternalEvent , NeedsUpdate , Queue ,
24+ StackablePopupOpen ,
2425 } ,
2526 setup_popups,
2627 strings:: { self , ellipsis_trim_start, order} ,
@@ -697,15 +698,15 @@ impl App {
697698
698699 fn switch_tab ( & mut self , k : & KeyEvent ) -> Result < ( ) > {
699700 if key_match ( k, self . key_config . keys . tab_status ) {
700- self . set_tab ( 0 ) ?;
701+ self . switch_to_tab ( & AppTabs :: Status ) ?;
701702 } else if key_match ( k, self . key_config . keys . tab_log ) {
702- self . set_tab ( 1 ) ?;
703+ self . switch_to_tab ( & AppTabs :: Log ) ?;
703704 } else if key_match ( k, self . key_config . keys . tab_files ) {
704- self . set_tab ( 2 ) ?;
705+ self . switch_to_tab ( & AppTabs :: Files ) ?;
705706 } else if key_match ( k, self . key_config . keys . tab_stashing ) {
706- self . set_tab ( 3 ) ?;
707+ self . switch_to_tab ( & AppTabs :: Stashing ) ?;
707708 } else if key_match ( k, self . key_config . keys . tab_stashes ) {
708- self . set_tab ( 4 ) ?;
709+ self . switch_to_tab ( & AppTabs :: Stashlist ) ?;
709710 }
710711
711712 Ok ( ( ) )
@@ -727,6 +728,17 @@ impl App {
727728 Ok ( ( ) )
728729 }
729730
731+ fn switch_to_tab ( & mut self , tab : & AppTabs ) -> Result < ( ) > {
732+ match tab {
733+ AppTabs :: Status => self . set_tab ( 0 ) ?,
734+ AppTabs :: Log => self . set_tab ( 1 ) ?,
735+ AppTabs :: Files => self . set_tab ( 2 ) ?,
736+ AppTabs :: Stashing => self . set_tab ( 3 ) ?,
737+ AppTabs :: Stashlist => self . set_tab ( 4 ) ?,
738+ }
739+ Ok ( ( ) )
740+ }
741+
730742 fn update_commands ( & mut self ) {
731743 if self . help . is_visible ( ) {
732744 self . help . set_cmds ( self . commands ( true ) ) ;
@@ -855,6 +867,10 @@ impl App {
855867 self . tags_popup . open ( ) ?;
856868 }
857869 InternalEvent :: TabSwitchStatus => self . set_tab ( 0 ) ?,
870+ InternalEvent :: TabSwitch ( tab) => {
871+ self . switch_to_tab ( & tab) ?;
872+ flags. insert ( NeedsUpdate :: ALL ) ;
873+ }
858874 InternalEvent :: SelectCommitInRevlog ( id) => {
859875 if let Err ( error) = self . revlog . select_commit ( id) {
860876 self . queue . push ( InternalEvent :: ShowErrorMsg (
0 commit comments