diff --git a/src/command/parse.rs b/src/command/parse.rs index 6f064ef..ff6a78d 100644 --- a/src/command/parse.rs +++ b/src/command/parse.rs @@ -37,18 +37,24 @@ pub fn parse_line_with(registry: &CmdRegistry, line: &str) -> Result Vec<&str> { let mut segments = Vec::new(); let mut start = 0; let mut in_quote = false; + let bytes = line.as_bytes(); for (i, c) in line.char_indices() { match c { '"' => in_quote = !in_quote, '.' if !in_quote => { - segments.push(&line[start..i]); - start = i + 1; + let before_ws = i == 0 || bytes[i - 1].is_ascii_whitespace(); + let after_ws = i + 1 >= bytes.len() || bytes[i + 1].is_ascii_whitespace(); + if before_ws && after_ws { + segments.push(&line[start..i]); + start = i + 1; + } } _ => {} }