diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-04-29 18:22:44 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-04-30 11:05:47 -0400 |
commit | 36d8299f224b044139d52c0f65eb66be4c25a5d0 (patch) | |
tree | 5f99fdfff153ab9f39c1d3ed77f9f18ef3c2d5d3 /src/commands/delete_files.rs | |
parent | 4bbe0969006eab7cfe3a47231d5e002b5259e19b (diff) |
cargo clippy
Diffstat (limited to 'src/commands/delete_files.rs')
-rw-r--r-- | src/commands/delete_files.rs | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/commands/delete_files.rs b/src/commands/delete_files.rs index 7850b51..283a1d3 100644 --- a/src/commands/delete_files.rs +++ b/src/commands/delete_files.rs @@ -41,20 +41,33 @@ impl DeleteFiles { ncurses::doupdate(); let curr_tab = &mut context.tabs[context.curr_tab_index]; - let ch: i32 = ncurses::getch(); + let ch = ncurses::getch(); if ch == 'y' as i32 || ch == keymap::ENTER as i32 { - if let Some(paths) = curr_tab.curr_list.get_selected_paths() { - Self::remove_files(paths)?; - ui::wprint_msg(&view.bot_win, "Deleted files"); - } + ui::wprint_msg(&view.bot_win, "Are you sure? (Y/n)"); + ncurses::doupdate(); + let ch = ncurses::getch(); + if ch == 'y' as i32 || ch == keymap::ENTER as i32 { + if let Some(paths) = curr_tab.curr_list.get_selected_paths() { + Self::remove_files(paths)?; + ui::wprint_msg(&view.bot_win, "Deleted files"); + } - curr_tab.reload_contents(&context.config_t.sort_option)?; - curr_tab.refresh( - &view, - &context.config_t, - &context.username, - &context.hostname, - ); + curr_tab.reload_contents(&context.config_t.sort_option)?; + curr_tab.refresh( + &view, + &context.config_t, + &context.username, + &context.hostname, + ); + } else { + curr_tab.refresh_file_status(&view.bot_win); + curr_tab.refresh_path_status( + &view.top_win, + &context.username, + &context.hostname, + context.config_t.tilde_in_titlebar, + ); + } } else { curr_tab.refresh_file_status(&view.bot_win); curr_tab.refresh_path_status( |