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:
Hakan Seven 2026-07-10 12:39:22 +03:00
commit 91ba9f7699
69 changed files with 767 additions and 164 deletions

View file

@ -208,10 +208,15 @@ impl OpenCADStudio {
self.command_line.push_info("Opening release notes...");
}
// ── CUI / ALIASEDIT — customization entry points ───────────────
// Command-alias and key-binding editing lives in the keyboard
// shortcuts panel, so route the customization verbs there.
"CUI" | "ALIASEDIT" => {
// ── ALIASEDIT — command-alias editor ───────────────────────────
// Opens the command-alias table editor (ocad.pgp). Keyboard
// key-bindings are edited separately via CUI (below).
"ALIASEDIT" => {
return Some(Task::done(Message::AliasEditorOpen));
}
// ── CUI — keyboard shortcut / key-binding editor ───────────────
"CUI" => {
return Some(Task::done(Message::ShortcutsPanelOpen));
}
@ -380,7 +385,7 @@ impl OpenCADStudio {
}
// ── Layout / viewport ──────────────────────────────────────────
"MVIEW" | "MV" => {
"MVIEW" => {
if self.tabs[i].scene.current_layout == "Model" {
self.command_line
.push_error("MVIEW: switch to a paper space layout first.");
@ -393,7 +398,7 @@ impl OpenCADStudio {
}
// ── MSPACE / PSPACE ───────────────────────────────────────────
"MS" | "MSPACE" => {
"MSPACE" => {
return Some(Task::done(Message::MspaceCommand));
}
"PSPACE" => {
@ -970,7 +975,7 @@ impl OpenCADStudio {
}
// HIDE — hidden-line view of the active viewport.
"HIDE" | "HI" => {
"HIDE" => {
return Some(Task::done(Message::SetRenderMode(
acadrust::entities::ViewportRenderMode::HiddenLine,
)));