From 60616750eacc0d9d7c929585bf9e06626a507d5a Mon Sep 17 00:00:00 2001 From: iff Date: Wed, 9 Aug 2023 17:46:40 +0200 Subject: [PATCH] fix: don't include non-espaced space in regex --- src/suggestions.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/suggestions.rs b/src/suggestions.rs index 3712cf0..f97d4f2 100644 --- a/src/suggestions.rs +++ b/src/suggestions.rs @@ -113,7 +113,7 @@ fn eval_shell_command(shell: &str, command: &str) -> Vec { pub fn split_command(command: &str) -> Vec { // this regex splits the command separated by spaces, except when the space // is escaped by a backslash or surrounded by quotes - let regex = r#"([^\s"'\\]+|"(?:\\.|[^"\\])*"|\\.+|'(?:\\.|[^'\\])*'|\\.)+"#; + let regex = r#"([^\s"'\\]+|"(?:\\.|[^"\\])*"|\\\s+|'(?:\\.|[^'\\])*'|\\\s)+"#; let regex = Regex::new(regex).unwrap(); let split_command = regex .find_iter(command)