@@ -99,7 +99,14 @@ enum InputMode {
9999
100100impl App {
101101 fn new ( current_dir : PathBuf , remote_enabled : bool ) -> Result < Self > {
102- let store = SessionStore :: open ( ) ?;
102+ let current_dir = current_dir. canonicalize ( ) . with_context ( || {
103+ format ! (
104+ "failed to resolve current directory {}" ,
105+ current_dir. display( )
106+ )
107+ } ) ?;
108+ let mut store = SessionStore :: open ( ) ?;
109+ store. record_recent_path ( & current_dir, RECENT_PATH_LIMIT ) ?;
103110 let sessions = store. load_local ( & current_dir) ?;
104111 let recent_paths = store. load_recent_paths ( RECENT_PATH_LIMIT ) ?;
105112 let removed_projects = store
@@ -713,6 +720,10 @@ impl App {
713720 self . message = "select a project to remove" . to_owned ( ) ;
714721 return Ok ( ( ) ) ;
715722 } ;
723+ if group. is_current {
724+ self . message = "current project is always shown" . to_owned ( ) ;
725+ return Ok ( ( ) ) ;
726+ }
716727
717728 let session_names = self
718729 . sessions
@@ -1122,7 +1133,7 @@ fn footer_shortcuts(app: &App) -> Vec<&'static str> {
11221133 None => { }
11231134 }
11241135
1125- if has_project {
1136+ if has_project && app . selected_group ( ) . is_some_and ( |group| !group . is_current ) {
11261137 shortcuts. push ( "d remove project" ) ;
11271138 }
11281139 if !app. sessions . is_empty ( ) {
@@ -2630,7 +2641,7 @@ fn tracked_project_dirs(
26302641 removed_projects : & BTreeSet < String > ,
26312642) -> Vec < PathBuf > {
26322643 let mut projects = BTreeMap :: new ( ) ;
2633- insert_project_dir ( & mut projects, current_dir. to_path_buf ( ) , removed_projects ) ;
2644+ projects. insert ( path_key ( current_dir ) , current_dir. to_path_buf ( ) ) ;
26342645 for session in sessions {
26352646 insert_project_dir ( & mut projects, session. project_dir . clone ( ) , removed_projects) ;
26362647 }
@@ -3089,13 +3100,25 @@ mod app_tests {
30893100 }
30903101
30913102 #[ test]
3092- fn tracked_projects_exclude_removed_paths ( ) {
3103+ fn tracked_projects_keep_current_when_removed ( ) {
30933104 let current = PathBuf :: from ( "/tmp/current-project" ) ;
30943105 let recent = vec ! [ PathBuf :: from( "/tmp/other-project" ) ] ;
30953106 let removed = [ path_key ( & current) ] . into_iter ( ) . collect :: < BTreeSet < _ > > ( ) ;
30963107 let projects = tracked_project_dirs ( & current, & [ ] , & [ ] , & recent, & removed) ;
30973108
3098- assert_eq ! ( projects, recent) ;
3109+ assert_eq ! ( projects. len( ) , 2 ) ;
3110+ assert ! ( projects. iter( ) . any( |path| path == & current) ) ;
3111+ assert ! ( projects. iter( ) . any( |path| path == & recent[ 0 ] ) ) ;
3112+ }
3113+
3114+ #[ test]
3115+ fn tracked_projects_exclude_removed_recent_paths ( ) {
3116+ let current = PathBuf :: from ( "/tmp/current-project" ) ;
3117+ let recent = vec ! [ PathBuf :: from( "/tmp/other-project" ) ] ;
3118+ let removed = [ path_key ( & recent[ 0 ] ) ] . into_iter ( ) . collect :: < BTreeSet < _ > > ( ) ;
3119+ let projects = tracked_project_dirs ( & current, & [ ] , & [ ] , & recent, & removed) ;
3120+
3121+ assert_eq ! ( projects, vec![ current] ) ;
30993122 }
31003123
31013124 #[ test]
0 commit comments