forked from 1b-agent/opencadstudio-upstream
feat(alias): centralize command aliases in user-editable ocad.pgp (#286/#288)
Command aliases (L→LINE, CC→COPYCLIP) were scattered across dispatch match arms and CommandRegistration name arrays. Move them all into a single user-editable file: - assets/ocad.pgp: shipped default alias table (ALIAS,*COMMAND format), embedded and copied to config/ocad.pgp on first launch; only that user copy is read after. AA→AREA default closes #286. - resolve_alias() rewrites the leading command token at the top of dispatch_command_inner, so aliases resolve for every path (families, plugins, Repeat menu). Args after the first space are untouched. - Autocomplete hides alias keys and, when the whole input is an alias, surfaces its target command as the top (highlighted) suggestion so the highlight matches what Enter runs (AA→AREA, L→LINE). - ALIASEDIT opens a new editor modal (add/edit/delete rows) with an Apply button; Apply persists to ocad.pgp, closing discards unapplied edits. - Strip alias tokens from all 8 dispatch match-arm files and 71 module CommandRegistration arrays, keeping canonical/synonym/distinct-command names. ocad.pgp is now the sole source: deleting or remapping an alias there takes effect. CUI stays on the keyboard-shortcut panel. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
f5b8a7d993
commit
91ba9f7699
69 files changed
+767
-164
No files matched your search
@@ -53,7 +53,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"COPYCLIP" | "CC" => {
|
||||
"COPYCLIP" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -142,7 +142,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"CUTCLIP" | "CX" => {
|
||||
"CUTCLIP" => {
|
||||
let handles: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
@@ -179,7 +179,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"PASTECLIP" | "PC" => {
|
||||
"PASTECLIP" => {
|
||||
if self.clipboard.is_empty() {
|
||||
self.command_line.push_error("Clipboard is empty.");
|
||||
} else {
|
||||
@@ -386,7 +386,7 @@ impl OpenCADStudio {
|
||||
// ADCENTER / CONTENTBROWSER — report the drawing's named content
|
||||
// (blocks and layers) from the command line in place of the browser
|
||||
// panel.
|
||||
"ADCENTER" | "CONTENTBROWSER" | "ADC" => {
|
||||
"ADCENTER" | "CONTENTBROWSER" => {
|
||||
let blocks = self.tabs[i].scene.custom_block_names();
|
||||
let layers: Vec<String> = self.tabs[i]
|
||||
.scene
|
||||
@@ -476,7 +476,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"XATTACH" | "XA" => {
|
||||
"XATTACH" => {
|
||||
// Launch the file picker; XAttachPickResult will start the command.
|
||||
return Some(Task::done(Message::XAttachPick));
|
||||
}
|
||||
@@ -498,7 +498,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"XREF" | "XR" => {
|
||||
"XREF" => {
|
||||
// List all xref blocks in the current drawing.
|
||||
let xrefs: Vec<String> = self.tabs[i]
|
||||
.scene
|
||||
|
||||
Reference in new issue
Block a user