Engine: Check Macro waits while a macro is being debugged

`macro.check` is a query, so the debugger's lock let it through, but its dry run runs the macro's
steps, which the lock refuses: the check reported the lock as the failure of a step. It now waits
with "Finish or stop the macro first", as other commands that change the workbook do.

- Test: `between_steps_only_looking_around_runs_and_the_run_continues_where_it_was`.
This commit is contained in:
prxnvt
2026-10-25 05:16:37 -04:00
parent 91bb5eded8
commit f225cd1026
3 changed files with 7 additions and 2 deletions
+3 -1
View File
@@ -51,7 +51,9 @@ pub const LOOKS_AROUND: &[&str] = &[
/// Whether command `id` (a query when `query`) runs on a workbook the debugger locks.
pub fn runs_while_locked(id: &str, query: bool) -> bool {
query || id == "macro.debug" || LOOKS_AROUND.contains(&id)
// `macro.check` is a query, but its dry run runs the macro's steps, which the lock refuses: it
// waits too, rather than report the lock as the failure of a step.
(query && id != "macro.check") || id == "macro.debug" || LOOKS_AROUND.contains(&id)
}
/// A macro being debugged.
+2
View File
@@ -440,6 +440,8 @@ fn between_steps_only_looking_around_runs_and_the_run_continues_where_it_was() {
assert!(busy(s.execute("file.save", json!({}))));
assert!(busy(s.execute("automate.recordActions", json!({}))));
assert!(busy(s.execute("cell.set", json!({"cell": "A1", "input": "x"}))));
// A check would dry-run the macro's steps, which the lock refuses: it waits too.
assert!(busy(s.execute("macro.check", json!({"name": "Sel"}))));
assert!(!path.exists(), "nothing was saved");
// The next step runs on the run's sheet and selection, as macro.run would.
let st = debug(&mut s, json!({"action": "step"}));
+2 -1
View File
@@ -185,7 +185,8 @@ While a macro is being debugged, its workbook is locked between steps: only `mac
`sheet.next` and `sheet.previous`, Go To, Go To Special, Find, Copy and the zoom commands), Switch
Window, Close (which ends the run with its workbook) and Automate › Stop Action run there.
Everything else, undoable or not, saving included, is refused with "Finish or stop the macro
first", also when another command runs it (stopping Record Actions saves a script). Other
first", also when another command runs it (stopping Record Actions saves a script), and so is
`macro.check`, whose dry run runs the macro's steps. Other
workbooks stay editable. The person may look around between steps: before the next step runs, the
debugger puts the active sheet and the selection back where the run left them, so the run goes on
as `macro.run` would run it. A zoom change made meanwhile is part of the run, and is undone with