diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-06-04 10:49:47 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-06-04 13:26:09 -0400 |
commit | 7036a7e6ff57b7e5e4b99133ea7466a3b24bf0ce (patch) | |
tree | a23141ae6474748f7ae49e04316136f2906fe7bd /src/commands/reload_dir.rs | |
parent | da20212f32c8b43400d0aec2af39376651f32b9d (diff) |
revert back to previous printing method
- fix index out of bounds error when multiple threads are running
Diffstat (limited to 'src/commands/reload_dir.rs')
-rw-r--r-- | src/commands/reload_dir.rs | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/src/commands/reload_dir.rs b/src/commands/reload_dir.rs index bd7c913..df8e9d9 100644 --- a/src/commands/reload_dir.rs +++ b/src/commands/reload_dir.rs @@ -19,38 +19,19 @@ impl ReloadDirList { pub fn reload( index: usize, - context: &mut JoshutoContext, - view: &JoshutoView, + context: &mut JoshutoContext ) -> Result<(), std::io::Error> { let curr_tab = &mut context.tabs[index]; let sort_option = &context.config_t.sort_option; curr_tab.curr_list.update_contents(sort_option)?; - if let Some(s) = curr_tab.curr_list.index { - let dir_len = curr_tab.curr_list.contents.len(); - curr_tab.curr_list.pagestate.update_page_state( - s, - view.mid_win.rows, - dir_len, - context.config_t.scroll_offset, - ); - curr_tab.curr_list.outdated = false; - } + curr_tab.curr_list.outdated = false; if let Some(parent) = curr_tab.curr_list.path.parent() { match curr_tab.history.entry(parent.to_path_buf().clone()) { Entry::Occupied(mut entry) => { let dirlist = entry.get_mut(); dirlist.update_contents(sort_option)?; - if let Some(s) = dirlist.index { - let dir_len = dirlist.contents.len(); - dirlist.pagestate.update_page_state( - s, - view.mid_win.rows, - dir_len, - context.config_t.scroll_offset, - ); - dirlist.outdated = false; - } + dirlist.outdated = false; } Entry::Vacant(entry) => { let s = JoshutoDirList::new(parent.to_path_buf().clone(), sort_option)?; @@ -76,7 +57,7 @@ impl JoshutoRunnable for ReloadDirList { context: &mut JoshutoContext, view: &JoshutoView, ) -> Result<(), JoshutoError> { - match Self::reload(context.curr_tab_index, context, view) { + match Self::reload(context.curr_tab_index, context) { Ok(_) => { let curr_tab = &mut context.tabs[context.curr_tab_index]; curr_tab.refresh(view, &context.config_t); |