feat: SCRIPTCOMMANDS setting to turn script-driven commands off

A saved user preference (on by default) toggled by the SCRIPTCOMMANDS command
gates HostApi::run_command; Cancel stays allowed so a waiting command is never
stranded. The runner refuses the SCRIPTCOMMANDS command itself, so a script
cannot change it. Documents why no helper-thread or stack-growing dependency was
added: native builds link with at least 8 MiB, the nesting depth is fixed, and the
deepest step found needs 2 to 4 MiB in a debug build.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Felix RiestraandClaude Sonnet 5 committed 2026-09-21 18:48:27 +02:00
1 parent a25ae4f8c0
commit 2ed41586de
8 files changed
+120 -15

No files matched your search

+3
View File
@@ -616,6 +616,8 @@ pub(super) struct OpenCADStudio {
/// Minutes between autosaves to a `.sv$` recovery file (SAVETIME command);
/// 0 disables autosave.
pub savetime_min: i32,
/// SCRIPTCOMMANDS: scripts may run OCS commands (see `UserSettings`).
pub script_commands: bool,
/// Persisted default viewport background, restored from settings and applied
/// to every drawing tab (new and opened) so a chosen background survives
/// restarts (#188). `None` = the built-in dark-grey / off-white defaults.
@@ -3956,6 +3958,7 @@ impl OpenCADStudio {
constraint_bar_display: 3,
constraint_bar_mode: 4095,
savetime_min: 10,
script_commands: true,
default_bg_color: None,
default_paper_bg_color: None,
cliprompt_lines: 3,