diff options
author | qkzk <qu3nt1n@gmail.com> | 2023-04-10 23:15:59 +0200 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2023-04-10 23:15:59 +0200 |
commit | 6e0764b8c1e5ff2cee8da8a683b709869acfdcc5 (patch) | |
tree | 59f406e0aa8479a1d34cf4da440f9df6915bac56 /src | |
parent | f393d198aafb462d6f60cf320ade48df6c720f44 (diff) |
simplify draw for second window
Diffstat (limited to 'src')
-rw-r--r-- | src/mode.rs | 1 | ||||
-rw-r--r-- | src/term_manager.rs | 27 |
2 files changed, 18 insertions, 10 deletions
diff --git a/src/mode.rs b/src/mode.rs index f50243d..b2d3b58 100644 --- a/src/mode.rs +++ b/src/mode.rs @@ -97,6 +97,7 @@ pub enum Navigate { Trash, /// Manipulate an encrypted device EncryptedDrive, + /// Manipulate an iso file to mount it IsoDevice, /// Jump to a saved mark Marks(MarkAction), diff --git a/src/term_manager.rs b/src/term_manager.rs index d34b373..80afbec 100644 --- a/src/term_manager.rs +++ b/src/term_manager.rs @@ -435,16 +435,7 @@ impl<'a> Draw for WinSecondary<'a> { fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> { canvas.clear()?; match self.tab.mode { - Mode::Navigate(Navigate::Jump) => self.destination(canvas, &self.status.flagged), - Mode::Navigate(Navigate::History) => self.destination(canvas, &self.tab.history), - Mode::Navigate(Navigate::Shortcut) => self.destination(canvas, &self.tab.shortcut), - Mode::Navigate(Navigate::Trash) => self.trash(canvas, &self.status.trash), - Mode::Navigate(Navigate::Compress) => self.compress(canvas, &self.status.compression), - Mode::Navigate(Navigate::Bulk) => self.bulk(canvas, &self.status.bulk), - Mode::Navigate(Navigate::EncryptedDrive) => self.encrypt(self.status, self.tab, canvas), - Mode::Navigate(Navigate::Marks(_)) => self.marks(self.status, canvas), - Mode::Navigate(Navigate::ShellMenu) => self.shell_menu(self.status, canvas), - Mode::Navigate(Navigate::CliInfo) => self.cli_info(self.status, canvas), + Mode::Navigate(mode) => self.navigate(mode, canvas), Mode::NeedConfirmation(mode) => self.confirm(self.status, self.tab, mode, canvas), Mode::InputCompleted(_) => self.completion(self.tab, canvas), Mode::InputSimple(mode) => Self::input_simple(mode, canvas), @@ -581,6 +572,22 @@ impl<'a> WinSecondary<'a> { Ok(()) } + fn navigate(&self, navigable_mode: Navigate, canvas: &mut dyn Canvas) -> Result<()> { + match navigable_mode { + Navigate::Bulk => self.bulk(canvas, &self.status.bulk), + Navigate::CliInfo => self.cli_info(self.status, canvas), + Navigate::Compress => self.compress(canvas, &self.status.compression), + Navigate::EncryptedDrive => self.encrypt(self.status, self.tab, canvas), + Navigate::History => self.destination(canvas, &self.tab.history), + Navigate::Jump => self.destination(canvas, &self.status.flagged), + Navigate::Marks(_) => self.marks(self.status, canvas), + Navigate::ShellMenu => self.shell_menu(self.status, canvas), + Navigate::Shortcut => self.destination(canvas, &self.tab.shortcut), + Navigate::Trash => self.trash(canvas, &self.status.trash), + _ => Ok(()), + } + } + /// Display the possible destinations from a selectable content of PathBuf. fn destination( &self, |