summaryrefslogtreecommitdiffstats
path: root/src/commands/change_directory.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/change_directory.rs')
-rw-r--r--src/commands/change_directory.rs26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/commands/change_directory.rs b/src/commands/change_directory.rs
index 220ca59..6ac2575 100644
--- a/src/commands/change_directory.rs
+++ b/src/commands/change_directory.rs
@@ -3,7 +3,7 @@ use std::path;
use crate::commands::reload;
use crate::context::AppContext;
use crate::error::AppResult;
-use crate::history::DirectoryHistory;
+use crate::history::{generate_entries_to_root, DirectoryHistory};
use crate::util::cwd;
// ChangeDirectory command
@@ -28,25 +28,19 @@ pub fn change_directory(context: &mut AppContext, mut path: &path::Path) -> AppR
};
cd(new_cwd.as_path(), context)?;
- let config = context.config_ref().clone();
- let options = context.config_ref().display_options_ref().clone();
- let ui_context = context.ui_context_ref().clone();
- let tab_options = context
- .tab_context_ref()
- .curr_tab_ref()
- .option_ref()
- .clone();
+ let dirlists = generate_entries_to_root(
+ new_cwd.as_path(),
+ context.config_ref(),
+ context.tab_context_ref().curr_tab_ref().history_ref(),
+ context.ui_context_ref(),
+ context.config_ref().display_options_ref(),
+ context.tab_context_ref().curr_tab_ref().option_ref(),
+ )?;
context
.tab_context_mut()
.curr_tab_mut()
.history_mut()
- .populate_to_root(
- new_cwd.as_path(),
- &config,
- &ui_context,
- &options,
- &tab_options,
- )?;
+ .insert_entries(dirlists);
Ok(())
}