diff options
-rw-r--r-- | src/joshuto/command/rename_file.rs | 8 | ||||
-rw-r--r-- | src/joshuto/structs.rs | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/joshuto/command/rename_file.rs b/src/joshuto/command/rename_file.rs index b385c50..a07e2ae 100644 --- a/src/joshuto/command/rename_file.rs +++ b/src/joshuto/command/rename_file.rs @@ -70,11 +70,11 @@ impl RenameFile { match fs::rename(&path, &new_path) { Ok(_) => { let curr_tab = &mut context.tabs[context.curr_tab_index]; - let path_clone = curr_tab.curr_list.as_ref().unwrap().path.clone(); - if let Ok(s) = JoshutoDirList::new(path_clone, &context.config_t.sort_type) { - curr_tab.curr_list = Some(s); - curr_tab.refresh_curr(&context.views.mid_win, &context.theme_t, context.config_t.scroll_offset); + if let Some(ref mut s) = curr_tab.curr_list { + s.update_contents(&context.config_t.sort_type).unwrap(); } + curr_tab.refresh_curr(&context.views.mid_win, + &context.theme_t, context.config_t.scroll_offset); }, Err(e) => { ui::wprint_err(&context.views.bot_win, e.to_string().as_str()); diff --git a/src/joshuto/structs.rs b/src/joshuto/structs.rs index 63d9b4d..a68e587 100644 --- a/src/joshuto/structs.rs +++ b/src/joshuto/structs.rs @@ -152,6 +152,7 @@ impl JoshutoDirList { } else if self.index >= contents_len { self.index = contents_len - 1; } else if self.index >= 0 && self.index < contents_len { + /* let index = self.index; let curr_file_name = &self.contents[index as usize].file_name; @@ -161,6 +162,7 @@ impl JoshutoDirList { break; } } + */ } else { self.index = 0; } |