diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.rs | 16 | ||||
| -rw-r--r-- | src/bibiman.rs | 3 | ||||
| -rw-r--r-- | src/cliargs.rs | 2 | ||||
| -rw-r--r-- | src/main.rs | 2 |
4 files changed, 14 insertions, 9 deletions
@@ -60,7 +60,7 @@ impl App { }) } - pub async fn run(&mut self, args: &mut CLIArgs) -> Result<()> { + pub async fn run(&mut self, args: &mut CLIArgs, cfg: &BibiConfig) -> Result<()> { let mut tui = tui::Tui::new()?; tui.enter()?; @@ -86,10 +86,10 @@ impl App { } else { CmdAction::from(key_event) }; - self.run_command(command, args, &mut tui)? + self.run_command(command, args, cfg, &mut tui)? } Event::Mouse(mouse_event) => { - self.run_command(CmdAction::from(mouse_event), args, &mut tui)? + self.run_command(CmdAction::from(mouse_event), args, cfg, &mut tui)? } Event::Resize(_, _) => {} @@ -111,7 +111,13 @@ impl App { self.running = false; } - pub fn run_command(&mut self, cmd: CmdAction, args: &mut CLIArgs, tui: &mut Tui) -> Result<()> { + pub fn run_command( + &mut self, + cmd: CmdAction, + args: &mut CLIArgs, + cfg: &BibiConfig, + tui: &mut Tui, + ) -> Result<()> { match cmd { CmdAction::Input(cmd) => match cmd { InputCmdAction::Nothing => {} @@ -304,7 +310,7 @@ impl App { } CmdAction::EditFile => { if let CurrentArea::EntryArea = self.bibiman.current_area { - self.bibiman.run_editor(args, tui)?; + self.bibiman.run_editor(cfg, args, tui)?; } } CmdAction::Open => { diff --git a/src/bibiman.rs b/src/bibiman.rs index 6aa138d..20cdfc6 100644 --- a/src/bibiman.rs +++ b/src/bibiman.rs @@ -328,7 +328,7 @@ impl Bibiman { self.entry_table.entry_table_state.select(Some(idx_count)); } - pub fn run_editor(&mut self, args: &CLIArgs, tui: &mut Tui) -> Result<()> { + pub fn run_editor(&mut self, cfg: &BibiConfig, args: &CLIArgs, tui: &mut Tui) -> Result<()> { // get filecontent and citekey for calculating line number let citekey: &str = &self.entry_table.entry_table_items [self.entry_table.entry_table_state.selected().unwrap()] @@ -379,6 +379,7 @@ impl Bibiman { tui.exit()?; // Use VISUAL or EDITOR. Set "vi" as last fallback let mut cmd: Command = EditorBuilder::new() + .source(cfg.general.editor.clone()) .environment() .source(Some("vi")) .build() diff --git a/src/cliargs.rs b/src/cliargs.rs index 50ed6f5..895f116 100644 --- a/src/cliargs.rs +++ b/src/cliargs.rs @@ -65,8 +65,6 @@ impl CLIArgs { } } - // args.files = parse_files(args.pos_args.clone()); - Ok(args) } } diff --git a/src/main.rs b/src/main.rs index 94f5042..37bead0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -56,6 +56,6 @@ async fn main() -> Result<()> { // Create an application. let mut app = App::new(&mut parsed_args, &mut cfg)?; - app.run(&mut parsed_args).await?; + app.run(&mut parsed_args, &cfg).await?; Ok(()) } |
