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 <noreply@anthropic.com>
This commit is contained in:
parent
bc92590725
commit
e141fb6df3
1 changed files with 10 additions and 0 deletions
|
|
@ -28,6 +28,16 @@ impl OpenCADStudio {
|
||||||
return Task::done(Message::OpenPathPicked(Some((path, size))));
|
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) {
|
if crate::plugin::try_dispatch(self, i, cmd) {
|
||||||
return Task::none();
|
return Task::none();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue