Make SolveApp::start honour a command's enabled flag, and disable solid.move inside a sketch (#740)

`SolveApp::start` now honours a command's enabled flag, so shortcuts, the command palette and the control channel can't start a disabled command, and Move is disabled while a sketch is open.
This commit is contained in:
William Dunn authored and GitHub committed 2026-10-13 11:43:45 -04:00
1 parent 62a7f903f2
commit ff609bc320
8 files changed
+132 -4

No files matched your search

+10
View File
@@ -530,6 +530,16 @@ impl SolveApp {
if self.file_load.busy() {
return;
}
// A disabled command starts nothing, however it was reached. The toolbar greys its
// button, but a shortcut, the command palette and the control channel all land here.
// Its reason goes to the status line, so the refusal is never silent.
if let Some(info) = solidcraft_engine::find_command(id).map(|c| c.info(&self.session))
&& let Some(why) = info.disabled_reason
{
let label = self.tr_label(info.label).to_string();
self.set_status(format!("{label}: {why}"), true);
return;
}
// Another command ends Edit Text (its dialog is not a feature edit to keep).
sketch_text_move::cancel_drag(self);
if sketch_text::editing(self) || self.dialog.as_ref().is_some_and(|d| matches!(d.kind, dialogs::Kind::TextMove(_))) {