From c3eff3e37075800559e2c775f5cb82ceff9e9b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Daron?= Date: Sun, 14 Jul 2024 15:39:18 +0200 Subject: [PATCH] fixing shellwords --- helix-core/src/shellwords.rs | 8 +++----- helix-term/src/commands/typed.rs | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/helix-core/src/shellwords.rs b/helix-core/src/shellwords.rs index 9a5ab37cb26b..2a1cb0801c3a 100644 --- a/helix-core/src/shellwords.rs +++ b/helix-core/src/shellwords.rs @@ -67,10 +67,8 @@ impl<'a> From<&'a str> for Shellwords<'a> { } } } - } else { - if c == '}' { - inside_variable_expansion = false; - } + } else if c == '}' { + inside_variable_expansion = false; } state = if !inside_variable_expansion { @@ -95,7 +93,7 @@ impl<'a> From<&'a str> for Shellwords<'a> { } c if c.is_ascii_whitespace() => { end = i; - Unquoted + OnWhitespace } _ => Unquoted, }, diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 428a7cfa9b37..50d63fdd7930 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -3241,7 +3241,7 @@ pub(super) fn command_mode(cx: &mut Context) { // Handle typable commands if let Some(cmd) = typed::TYPABLE_COMMAND_MAP.get(parts[0]) { - let shellwords = Shellwords::from(input.as_ref()); + let shellwords = Shellwords::from(input); let words = shellwords.words().to_vec(); let args = if event == PromptEvent::Validate { match cx.editor.expand_variables(&words) {