diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-05-29 23:06:38 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-05-29 23:07:27 -0400 |
commit | 5980d762dba38b003dbe54506cdd58ee85f97c8c (patch) | |
tree | 28e07e112586b73e1de426f7ae34c8c2afc68fdb /src/commands/reload_dir.rs | |
parent | 5d8525a9cc8a61e8e66a92f66132ad11ce112ff7 (diff) |
move hostname and username out of Context and into a static global
Diffstat (limited to 'src/commands/reload_dir.rs')
-rw-r--r-- | src/commands/reload_dir.rs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/commands/reload_dir.rs b/src/commands/reload_dir.rs index 8891688..fc0dd78 100644 --- a/src/commands/reload_dir.rs +++ b/src/commands/reload_dir.rs @@ -16,13 +16,20 @@ impl ReloadDirList { pub fn reload(context: &mut JoshutoContext, view: &JoshutoView) -> Result<(), std::io::Error> { let curr_tab = &mut context.tabs[context.curr_tab_index]; - curr_tab.reload_contents(&context.config_t.sort_option)?; - curr_tab.refresh( - view, - &context.config_t, - &context.username, - &context.hostname, - ); + let dir_len = curr_tab.curr_list.contents.len(); + match curr_tab.curr_list.index { + None => {} + Some(s) => { + curr_tab.curr_list.pagestate.update_page_state( + s, + view.mid_win.rows, + dir_len, + context.config_t.scroll_offset, + ); + curr_tab.reload_contents(&context.config_t.sort_option)?; + curr_tab.refresh(view, &context.config_t); + } + } Ok(()) } } |