From 76c8a74cb4680a3e16839980af54f8eb4cdf983b Mon Sep 17 00:00:00 2001 From: Vulpesx Date: Thu, 15 Aug 2024 20:00:53 +1000 Subject: [PATCH] optionaly join args --- helix-view/src/editor.rs | 4 ++++ helix-view/src/handlers/dap.rs | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 1708b3b4e..81359fdb4 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -370,6 +370,8 @@ pub struct TerminalConfig { #[serde(default)] #[serde(skip_serializing_if = "Vec::is_empty")] pub args: Vec, + #[serde(default)] + pub join_args: bool, } #[cfg(windows)] @@ -403,6 +405,7 @@ pub fn get_terminal_provider() -> Option { return Some(TerminalConfig { command: "tmux".to_string(), args: vec!["split-window".to_string()], + join_args: false, }); } @@ -410,6 +413,7 @@ pub fn get_terminal_provider() -> Option { return Some(TerminalConfig { command: "wezterm".to_string(), args: vec!["cli".to_string(), "split-pane".to_string()], + join_args: false, }); } diff --git a/helix-view/src/handlers/dap.rs b/helix-view/src/handlers/dap.rs index 81766dd59..2d7a0f73d 100644 --- a/helix-view/src/handlers/dap.rs +++ b/helix-view/src/handlers/dap.rs @@ -366,12 +366,16 @@ impl Editor { Some(debugger) => debugger, None => return false, }; + let mut process = std::process::Command::new(config.command); - let process = match std::process::Command::new(config.command) - .args(config.args) - .arg(arguments.args.join(" ")) - .spawn() - { + + if config.join_args { + process.arg(arguments.args.join(" ")); + } else { + process.args(arguments.args); + } + + let process = match process.spawn() { Ok(process) => process, Err(err) => { self.set_error(format!("Error starting external terminal: {}", err));