diff options
author | qkzk <qu3nt1n@gmail.com> | 2023-10-16 17:59:42 +0200 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2023-10-16 18:00:19 +0200 |
commit | 087bf81a88d58236b28072c53163d85479a2dfd7 (patch) | |
tree | 6bfb187ec161b98ba5ba4c3bed649d8c4a38b134 /src/event_exec.rs | |
parent | f2568d1b7e6c932e0a7172d7bc24fb5ab3ddba92 (diff) |
regroup openers when opening multiple files
Diffstat (limited to 'src/event_exec.rs')
-rw-r--r-- | src/event_exec.rs | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/src/event_exec.rs b/src/event_exec.rs index 561a5d8..fc29493 100644 --- a/src/event_exec.rs +++ b/src/event_exec.rs @@ -27,7 +27,7 @@ use crate::mocp::Mocp; use crate::mode::{InputSimple, MarkAction, Mode, Navigate, NeedConfirmation}; use crate::opener::{ execute_and_capture_output, execute_and_capture_output_without_check, execute_in_child, - execute_in_child_without_output_with_path, InternalVariant, + execute_in_child_without_output_with_path, }; use crate::password::{PasswordKind, PasswordUsage}; use crate::preview::ExtensionKind; @@ -344,45 +344,13 @@ impl EventAction { /// their respective opener. /// Directories aren't opened since it will lead nowhere, it would only replace the /// current tab multiple times. It may change in the future. - /// Another strange behavior, it doesn't regroup files by opener : opening multiple - /// text file will create a process per file. - /// This may also change in the future. + /// Only files which use an external opener are supported. pub fn open_file(status: &mut Status) -> Result<()> { if status.flagged.is_empty() { - let filepath = &status - .selected_non_mut() - .selected() - .context("event open file, Empty directory")? - .path - .clone(); - Self::open_filepath(status, filepath)?; + status.open_selected_file() } else { - let content = status.flagged.content().clone(); - for flagged in content.iter() { - if !flagged.is_dir() { - Self::open_filepath(status, flagged)? - } - } + status.open_flagged_files() } - Ok(()) - } - - /// Open a single file with its own opener - fn open_filepath(status: &mut Status, filepath: &path::Path) -> Result<()> { - let opener = status.opener.open_info(filepath); - if let Some(InternalVariant::NotSupported) = opener.internal_variant.as_ref() { - status.mount_iso_drive()?; - } else { - match status.opener.open(filepath) { - Ok(_) => (), - Err(e) => info!( - "Error opening {:?}: {:?}", - status.selected_non_mut().path_content.selected(), - e - ), - } - } - Ok(()) } /// Enter the rename mode. |