mirror of
https://github.com/storytold/cadcraft.git
synced 2026-10-24 10:56:51 -06:00
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user