Engine: Stop Action runs on its own and is not recorded

Run from inside another command, automate.stopAction rolled back that
command's own group, pulling the workbook from under the rest of its run; and
the recording buffer kept it, so a recording could replay the stop inside the
run it was part of. Nested, the command is refused and the group stays; the
recorder leaves it out (record::NOT_RECORDED).
This commit is contained in:
prxnvt
2026-10-24 02:18:07 -04:00
parent f040b4ecaa
commit 6cd4cebfb7
5 changed files with 48 additions and 1 deletions
+5
View File
@@ -1099,6 +1099,11 @@ fn run_script(s: &mut Session, p: &Json) -> Result<Json> {
/// Automate › Stop Action: rolls back the undo groups open on the active workbook, so Undo and
/// Redo work there again.
fn stop_action(s: &mut Session, _: &Json) -> Result<Json> {
// Inside another command the open groups are that command's own (an action in progress):
// a step of it that stopped them would pull the workbook from under the rest of its run.
if s.depth() > 1 {
return Err(EngineError::Disabled("automate.stopAction".into(), "Stop Action runs on its own, not as a step of a script or macro.".into()));
}
let uid = s.doc()?.uid;
Ok(json!({"stopped": s.abort_groups(uid)}))
}