forked from 1b-agent/opencadstudio-upstream
Merge remote-tracking branch 'origin/main' into codex/field-command
# Conflicts: # src/ui/window/attdef_dialog.rs
This commit is contained in:
commit
762cf1e7e4
68 files changed
+4665
-1048
No files matched your search
+29
-1
@@ -22,6 +22,7 @@ mod pc_extract;
|
||||
mod pdf_underlay;
|
||||
mod pdf_dialogs;
|
||||
mod xclip;
|
||||
mod blockvars;
|
||||
mod plotvars;
|
||||
mod styleprops;
|
||||
mod view;
|
||||
@@ -198,7 +199,7 @@ impl OpenCADStudio {
|
||||
// editors (shortcuts, aliases) — none of them read the scene. This is
|
||||
// the single place that decides; `on_ribbon_tool_click` defers to it
|
||||
// rather than keeping a second, blunter copy (#388, #389).
|
||||
if self.tabs[i].is_start && !start_allowed(cmd) {
|
||||
if self.tabs[i].is_start && !start_allowed(strip_command_prefixes(cmd).unwrap_or(cmd)) {
|
||||
self.command_line
|
||||
.push_info(crate::t!("No drawing open. Use NEW or OPEN to start a drawing.").as_ref());
|
||||
return Task::none();
|
||||
@@ -230,6 +231,15 @@ impl OpenCADStudio {
|
||||
return t;
|
||||
}
|
||||
|
||||
// Scripts and typed input may carry the international (`_`) and
|
||||
// built-in (`.`) name prefixes (`_LINE`, `._LINE`). Ribbon tools
|
||||
// dispatch internal names that start with `_` themselves
|
||||
// (`_PCCROPPOLY`), so a name is tried as written first and loses its
|
||||
// prefixes only when nothing handles it.
|
||||
if let Some(bare) = strip_command_prefixes(cmd) {
|
||||
return self.dispatch_command_inner(bare, allow_suggest);
|
||||
}
|
||||
|
||||
// No family matched. From the interactive command line, run the
|
||||
// closest autocomplete suggestion instead of erroring, so a partial
|
||||
// command completes on Enter (`BAC` → `BACKGROUND`). The verb's own
|
||||
@@ -304,6 +314,9 @@ impl OpenCADStudio {
|
||||
if let Some(t) = self.dispatch_plotvars(cmd, i) {
|
||||
return Some(t);
|
||||
}
|
||||
if let Some(t) = self.dispatch_blockvars(cmd, i) {
|
||||
return Some(t);
|
||||
}
|
||||
if let Some(t) = self.dispatch_styleprops(cmd, i) {
|
||||
return Some(t);
|
||||
}
|
||||
@@ -481,6 +494,14 @@ inventory::submit!(crate::command::CommandRegistration {
|
||||
// Block list + block-attribute list (command-line forms).
|
||||
"BLOCKPALETTE",
|
||||
"BLOCKSPALETTE",
|
||||
"BLOCKSPALETTECLOSE",
|
||||
"-INSERT",
|
||||
"BLOCKMRULIST",
|
||||
"BLOCKREDEFINEMODE",
|
||||
"BLOCKNAVIGATE",
|
||||
"BLOCKSTATE",
|
||||
"EXPLMODE",
|
||||
"INSNAME",
|
||||
"ATTMAN",
|
||||
"BATTMAN",
|
||||
// Drawing-content overview.
|
||||
@@ -1042,3 +1063,10 @@ mod marquee_cancel_tests {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// `cmd` without its leading `_` / `.` name prefixes (`_LINE`, `.LINE`,
|
||||
/// `._LINE`), or `None` when it carries none.
|
||||
fn strip_command_prefixes(cmd: &str) -> Option<&str> {
|
||||
let bare = cmd.trim_start_matches(['_', '.']);
|
||||
(bare.len() != cmd.len() && !bare.is_empty()).then_some(bare)
|
||||
}
|
||||
Reference in new issue
Block a user