diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-06-01 12:09:03 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-06-01 12:10:20 -0400 |
commit | da20212f32c8b43400d0aec2af39376651f32b9d (patch) | |
tree | 648fb4d4db28428961b336e25d837b3c797acbf6 /src/run.rs | |
parent | bfb110a7c6a23692d6ffeca616aa5ca070869797 (diff) |
fix issue with refreshing after paste
Diffstat (limited to 'src/run.rs')
-rw-r--r-- | src/run.rs | 25 |
1 files changed, 15 insertions, 10 deletions
@@ -47,6 +47,19 @@ fn recurse_get_keycommand(keymap: &JoshutoCommandMapping) -> Option<&Box<Joshuto } } +fn reload_tab( + index: usize, + context: &mut JoshutoContext, + view: &JoshutoView, +) -> Result<(), std::io::Error> { + ReloadDirList::reload(index, context, view)?; + if index == context.curr_tab_index { + let dirty_tab = &mut context.tabs[index]; + dirty_tab.refresh(view, &context.config_t); + } + Ok(()) +} + fn join_thread( context: &mut JoshutoContext, thread: FileOperationThread, @@ -63,18 +76,10 @@ fn join_thread( } Ok(_) => { if tab_src < context.tabs.len() { - ReloadDirList::reload(tab_src, context, view)?; - if tab_src == context.curr_tab_index { - let dirty_tab = &mut context.tabs[tab_src]; - dirty_tab.refresh(view, &context.config_t); - } + reload_tab(tab_src, context, view)?; } if tab_dest != tab_src && tab_dest < context.tabs.len() { - ReloadDirList::reload(tab_dest, context, view)?; - if tab_src == context.curr_tab_index { - let dirty_tab = &mut context.tabs[tab_dest]; - dirty_tab.refresh(view, &context.config_t); - } + reload_tab(tab_dest, context, view)?; } } } |