diff options
author | qkzk <qu3nt1n@gmail.com> | 2023-11-12 17:01:39 +0100 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2023-11-12 17:01:39 +0100 |
commit | 0035f68224db9d7bb9a976fc3c95dc59e3a1adb7 (patch) | |
tree | 98af988d936b04f39005bb268affbc5d64baf810 | |
parent | 43f393c0806de4804660877f733240301e40ac11 (diff) |
aze
-rw-r--r-- | src/term_manager.rs | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/term_manager.rs b/src/term_manager.rs index 977e318..0c3926d 100644 --- a/src/term_manager.rs +++ b/src/term_manager.rs @@ -967,25 +967,7 @@ impl<'a> WinSecondary<'a> { ) -> Result<()> { info!("confirmed action: {:?}", confirmed_mode); match confirmed_mode { - NeedConfirmation::EmptyTrash => { - if self.status.trash.is_empty() { - let _ = canvas.print_with_attr( - ContentWindow::WINDOW_MARGIN_TOP + 2, - 4, - "Trash is empty", - ATTR_YELLOW_BOLD, - ); - } else { - for (row, trashinfo) in self.status.trash.content().iter().enumerate() { - canvas.print_with_attr( - row + ContentWindow::WINDOW_MARGIN_TOP + 2, - 4, - &format!("{trashinfo}"), - Attr::default(), - )?; - } - } - } + NeedConfirmation::EmptyTrash => self.draw_confirm_empty_trash(canvas)?, _ => { for (row, path) in self.status.flagged.content.iter().enumerate() { canvas.print_with_attr( @@ -1016,6 +998,27 @@ impl<'a> WinSecondary<'a> { Ok(()) } + + fn draw_confirm_empty_trash(&self, canvas: &mut dyn Canvas) -> Result<()> { + if self.status.trash.is_empty() { + let _ = canvas.print_with_attr( + ContentWindow::WINDOW_MARGIN_TOP + 2, + 4, + "Trash is empty", + ATTR_YELLOW_BOLD, + ); + } else { + for (row, trashinfo) in self.status.trash.content().iter().enumerate() { + canvas.print_with_attr( + row + ContentWindow::WINDOW_MARGIN_TOP + 2, + 4, + &format!("{trashinfo}"), + Attr::default(), + )?; + } + } + Ok(()) + } } impl<'a> Widget for WinSecondary<'a> {} |