fix(command): block drawing commands on the Start tab (#96)

The Start (welcome) tab has no drawing, so commands like LINE dispatched
from the command line or ribbon ran as silent no-ops. Allow only the
commands that make sense there (NEW / OPEN / EXIT / QUIT; OPEN_RECENT is
handled earlier) and inform the user otherwise.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-14 00:42:02 +03:00
1 parent bc92590725
commit e141fb6df3
1 file changed
+10
+10
View File
@@ -28,6 +28,16 @@ impl OpenCADStudio {
return Task::done(Message::OpenPathPicked(Some((path, size))));
}
// The Start (welcome) tab has no drawing to act on, so a drawing
// command would silently do nothing. Allow only the commands that
// make sense there (create / open a document, or quit) and tell the
// user otherwise instead of running a no-op. See #96.
if self.tabs[i].is_start && !matches!(cmd, "NEW" | "OPEN" | "EXIT" | "QUIT") {
self.command_line
.push_info("No drawing open. Use NEW or OPEN to start a drawing.");
return Task::none();
}
if crate::plugin::try_dispatch(self, i, cmd) {
return Task::none();
}