diff options
Diffstat (limited to 'src/commands/change_directory.rs')
-rw-r--r-- | src/commands/change_directory.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/commands/change_directory.rs b/src/commands/change_directory.rs index ac97d59..022d306 100644 --- a/src/commands/change_directory.rs +++ b/src/commands/change_directory.rs @@ -22,10 +22,7 @@ impl ChangeDirectory { pub fn cd(path: &path::Path, context: &mut JoshutoContext) -> std::io::Result<()> { std::env::set_current_dir(path)?; - - let curr_tab = &mut context.tabs[context.curr_tab_index]; - curr_tab.curr_path = path.to_path_buf(); - + context.tab_context_mut().curr_tab_mut().set_pwd(path); Ok(()) } @@ -35,10 +32,12 @@ impl ChangeDirectory { ) -> std::io::Result<()> { Self::cd(path, context)?; - let curr_tab = &mut context.tabs[context.curr_tab_index]; - curr_tab + let sort_options = context.config_t.sort_option.clone(); + context + .tab_context_mut() + .curr_tab_mut() .history - .populate_to_root(&path, &context.config_t.sort_option)?; + .populate_to_root(&path, &sort_options)?; Ok(()) } |