diff --git a/src/app/command_driver.rs b/src/app/command_driver.rs index 0b93ed8f5..c921e4615 100644 --- a/src/app/command_driver.rs +++ b/src/app/command_driver.rs @@ -556,15 +556,9 @@ impl OpenCADStudio { if is_escape { self.tabs[i].pending_pause_tokens = None; } - let task = match result { + match result { Some(r) => self.apply_cmd_result(r), None => Task::none(), - }; - if !is_escape && self.tabs[i].active_cmd.is_some() && self.tabs[i].pending_pause_tokens.is_some() { - let drain_task = self.drain_pending_pause_tokens(i); - Task::batch([task, drain_task]) - } else { - task } } @@ -1075,8 +1069,14 @@ impl OpenCADStudio { self.tabs[i].scene.set_hover_highlight(None); self.command_line.set_step_options(Vec::new()); self.restore_add_selected_defaults(); + self.tabs[i].pending_pause_tokens = None; + } + if self.tabs[i].active_cmd.is_some() && self.tabs[i].pending_pause_tokens.is_some() { + let drain_task = self.drain_pending_pause_tokens(i); + Task::batch([task, drain_task]) + } else { + task } - task } /// Resolve the cell under `click` on table `handle` (or any table in the drawing diff --git a/src/app/plugin_host.rs b/src/app/plugin_host.rs index f50981609..c38f339d7 100644 --- a/src/app/plugin_host.rs +++ b/src/app/plugin_host.rs @@ -1178,11 +1178,14 @@ mod tests { host.app.tabs[0].pending_pause_tokens, Some(vec!["ENTER".to_string()]) ); - // User clicks second point in viewport - let _ = host - .app - .feed_command(crate::command::StepInput::Point(glam::DVec3::new(30.0, 30.0, 0.0))); - // Draining should have executed ENTER and completed LINE + // User clicks second point in viewport (which calls on_point + apply_cmd_result) + let r = host.app.tabs[0] + .active_cmd + .as_mut() + .unwrap() + .on_point(glam::DVec3::new(30.0, 30.0, 0.0)); + let _ = host.app.apply_cmd_result(r); + // Draining in apply_cmd_result should have executed ENTER and completed LINE assert!(host.app.tabs[0].active_cmd.is_none()); assert_eq!(host.document().entities().count(), 3);