fix arg parsing

pull/8675/merge^2
Matt Paras 2025-02-27 08:51:15 -08:00
parent d17dd3115f
commit d00294c76e
2 changed files with 7 additions and 7 deletions

View File

@ -108,12 +108,12 @@ impl ScriptingEngine {
pub fn call_typed_command<'a>( pub fn call_typed_command<'a>(
cx: &mut compositor::Context, cx: &mut compositor::Context,
input: &'a str, command: &'a str,
parts: &'a [&'a str], parts: &'a [&'a str],
event: PromptEvent, event: PromptEvent,
) -> bool { ) -> bool {
for kind in PLUGIN_PRECEDENCE { for kind in PLUGIN_PRECEDENCE {
if manual_dispatch!(kind, call_typed_command(cx, input, parts, event)) { if manual_dispatch!(kind, call_typed_command(cx, command, parts, event)) {
return true; return true;
} }
} }

View File

@ -1194,11 +1194,11 @@ impl super::PluginSystem for SteelScriptingEngine {
fn call_typed_command<'a>( fn call_typed_command<'a>(
&self, &self,
cx: &mut compositor::Context, cx: &mut compositor::Context,
input: &'a str, command: &'a str,
parts: &'a [&'a str], parts: &'a [&'a str],
event: PromptEvent, event: PromptEvent,
) -> bool { ) -> bool {
if enter_engine(|x| x.global_exists(parts[0])) { if enter_engine(|x| x.global_exists(command)) {
// let shellwords = Shellwords::from(input); // let shellwords = Shellwords::from(input);
// let args = shellwords.words(); // let args = shellwords.words();
let args = parts; let args = parts;
@ -1206,9 +1206,9 @@ impl super::PluginSystem for SteelScriptingEngine {
// We're finalizing the event - we actually want to call the function // We're finalizing the event - we actually want to call the function
if event == PromptEvent::Validate { if event == PromptEvent::Validate {
if let Err(e) = enter_engine(|guard| { if let Err(e) = enter_engine(|guard| {
let args = args[1..] let args = args
.iter() .iter()
.map(|x| x.clone().into_steelval().unwrap()) .map(|x| x.into_steelval().unwrap())
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let res = { let res = {
@ -1230,7 +1230,7 @@ impl super::PluginSystem for SteelScriptingEngine {
let context = arguments[0].clone(); let context = arguments[0].clone();
engine.update_value("*helix.cx*", context); engine.update_value("*helix.cx*", context);
// TODO: Fix this clone // TODO: Fix this clone
engine.call_function_by_name_with_args(&parts[0], args.clone()) engine.call_function_by_name_with_args(command, args.clone())
}) })
}) { }) {
Ok(res) => { Ok(res) => {