diff options
author | rabite <rabite@posteo.de> | 2019-05-28 00:50:15 +0200 |
---|---|---|
committer | rabite <rabite@posteo.de> | 2019-05-28 00:51:47 +0200 |
commit | ad4e3d573fffe2412c7840319c39ca4a64c02b56 (patch) | |
tree | 06a8e64a71859fbb448cc37e523b8bcc8ab606d2 /src/file_browser.rs | |
parent | fdc4eb52d0403e041fe77f403b0dbc5686789087 (diff) |
add quick actions
Diffstat (limited to 'src/file_browser.rs')
-rw-r--r-- | src/file_browser.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/file_browser.rs b/src/file_browser.rs index ad15d01..b8d15dd 100644 --- a/src/file_browser.rs +++ b/src/file_browser.rs @@ -468,6 +468,7 @@ impl FileBrowser { cmd: OsString::from(file.strip_prefix(&cwd)), short_cmd: None, args: None, + vars: None, cwd: cwd.clone(), cwd_files: None, tab_files: None, @@ -1084,6 +1085,7 @@ impl FileBrowser { cmd: OsString::from(cmd), short_cmd: None, args: None, + vars: None, cwd: cwd, cwd_files: cwd_files, tab_files: Some(tab_files), @@ -1135,6 +1137,22 @@ impl FileBrowser { Ok(()) } + pub fn quick_action(&self) -> HResult<()> { + let files = self.selected_files()?; + let files = if files.len() > 0 { files } + else { vec![self.selected_file()?.clone()] }; + + let sender = self.core.get_sender(); + let core = self.preview_widget()?.get_core()?.clone(); + let proc_view = self.proc_view.clone(); + + crate::quick_actions::open(files, + sender, + core, + proc_view)?; + Ok(()) + } + pub fn get_footer(&self) -> HResult<String> { let xsize = self.get_coordinates()?.xsize(); let ypos = self.get_coordinates()?.position().y(); @@ -1263,6 +1281,7 @@ impl Widget for FileBrowser { fn on_key(&mut self, key: Key) -> HResult<()> { match key { + Key::Char('a') => self.quick_action()?, Key::Char(']') => self.move_down_left_widget()?, Key::Char('[') => self.move_up_left_widget()?, Key::Alt(' ') => self.external_select()?, |