diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 71b7c736a..4f7023198 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -809,7 +809,8 @@ impl Session { } let mut rest = line; loop { - let text_prompt = self.current_prompt().is_some_and(|p| p.accept.text && !p.accept.point); + // Free text only when the prompt has no keywords; otherwise split so `I 15` reaches the keyword and the value. + let text_prompt = self.current_prompt().is_some_and(|p| p.accept.text && !p.accept.point && p.keywords.is_empty()); if text_prompt || self.running.is_none() && rest.contains('{') { self.cmdline(rest)?; break; diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 3688c757f..0abd994ab 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -460,6 +460,13 @@ fn script_runs_commands() { assert!(matches!(&t.kind, EntityKind::Text(t) if t.value == "Hello world")); } +#[test] +fn script_splits_line_at_keyword_prompt() { + let mut s = Session::new(); + s.script("POLYGON 6 200,20 I 15").unwrap(); + assert_eq!(kinds(&s), vec!["Polyline"]); +} + #[test] fn enter_repeats_last_command() { let mut s = Session::new();