From 2ed8a79d7ba89bd37b89c1cd853ead3adb59347a Mon Sep 17 00:00:00 2001 From: Jiayi Zhao Date: Mon, 25 Feb 2019 13:18:10 -0500 Subject: add verbose messages for file operations --- src/commands/change_directory.rs | 1 - src/commands/delete_files.rs | 6 +++++- src/commands/file_operations.rs | 3 +-- src/run.rs | 6 +++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/commands/change_directory.rs b/src/commands/change_directory.rs index de0f418..0b96145 100644 --- a/src/commands/change_directory.rs +++ b/src/commands/change_directory.rs @@ -1,5 +1,4 @@ use std::path; -use std::process; use crate::commands::{JoshutoCommand, JoshutoRunnable}; use crate::context::JoshutoContext; diff --git a/src/commands/delete_files.rs b/src/commands/delete_files.rs index e72d364..3823f57 100644 --- a/src/commands/delete_files.rs +++ b/src/commands/delete_files.rs @@ -51,7 +51,11 @@ impl JoshutoRunnable for DeleteFiles { if let Some(paths) = commands::collect_selected_paths(s) { match Self::remove_files(paths) { Ok(_) => ui::wprint_msg(&context.views.bot_win, "Deleted files"), - Err(e) => ui::wprint_err(&context.views.bot_win, e.to_string().as_str()), + Err(e) => { + ui::wprint_err(&context.views.bot_win, e.to_string().as_str()); + ncurses::doupdate(); + return; + } } } } diff --git a/src/commands/file_operations.rs b/src/commands/file_operations.rs index aee5232..ab28220 100644 --- a/src/commands/file_operations.rs +++ b/src/commands/file_operations.rs @@ -279,8 +279,7 @@ impl PasteFiles { tx.send(progress_info).unwrap(); fs_extra::dir::TransitProcessResult::ContinueOrAbort }; - fs_extra::copy_items_with_progress(&paths, &destination, &options, handle).unwrap(); - + fs_extra::copy_items_with_progress(&paths, &destination, &options, handle); paths.clear(); 0 }); diff --git a/src/run.rs b/src/run.rs index d5a6cad..3c80308 100644 --- a/src/run.rs +++ b/src/run.rs @@ -9,9 +9,7 @@ use crate::preview; use crate::ui; use crate::window::JoshutoPanel; -fn recurse_get_keycommand( - keymap: &HashMap, -) -> Option<&Box> { +fn recurse_get_keycommand(keymap: &HashMap) -> Option<&Box> { let (term_rows, term_cols) = ui::getmaxyx(); ncurses::timeout(-1); @@ -49,6 +47,7 @@ fn recurse_get_keycommand( } } +#[inline] fn process_threads(context: &mut JoshutoContext) { let thread_wait_duration: time::Duration = time::Duration::from_millis(100); @@ -129,6 +128,7 @@ fn process_threads(context: &mut JoshutoContext) { } } +#[inline] fn resize_handler(context: &mut JoshutoContext) { ui::redraw_tab_view(&context.views.tab_win, &context); { -- cgit v1.2.3