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 SevenandClaude Opus 4.8 committed 2026-07-10 12:39:22 +03:00
1 parent f5b8a7d993
commit 91ba9f7699
69 files changed
+767 -164

No files matched your search

+1 -1
View File
@@ -192,4 +192,4 @@ impl AlignCommand {
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration { names: &["AL", "ALIGN"] }); // AlignCommand
inventory::submit!(crate::command::CommandRegistration { names: &["ALIGN"] }); // AlignCommand
+1 -1
View File
@@ -62,4 +62,4 @@ impl CadCommand for AtteditCommand {
}
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration { names: &["ATTEDIT", "ATE"] });
inventory::submit!(crate::command::CommandRegistration { names: &["ATTEDIT"] });
+2 -2
View File
@@ -470,5 +470,5 @@ impl CadCommand for BreakAtPointCommand {
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration { names: &["BAP", "BREAKATPOINT"] }); // BreakAtPointCommand
inventory::submit!(crate::command::CommandRegistration { names: &["BR", "BREAK"] }); // BreakInteractiveCommand
inventory::submit!(crate::command::CommandRegistration { names: &["BREAKATPOINT"] }); // BreakAtPointCommand
inventory::submit!(crate::command::CommandRegistration { names: &["BREAK"] }); // BreakInteractiveCommand
+2 -2
View File
@@ -1950,5 +1950,5 @@ impl CadCommand for ChamferCommand {
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration { names: &["CHA", "CHAMFER"] }); // ChamferCommand
inventory::submit!(crate::command::CommandRegistration { names: &["F", "FILLET"] }); // FilletCommand
inventory::submit!(crate::command::CommandRegistration { names: &["CHAMFER"] }); // ChamferCommand
inventory::submit!(crate::command::CommandRegistration { names: &["FILLET"] }); // FilletCommand
+1 -1
View File
@@ -264,4 +264,4 @@ fn is_collinear(verts: &[(DVec3, f64)]) -> bool {
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration { names: &["J", "JOIN"] }); // JoinCommand
inventory::submit!(crate::command::CommandRegistration { names: &["JOIN"] }); // JoinCommand
+1 -1
View File
@@ -512,4 +512,4 @@ fn lengthen_spline(spl: &SplineEnt, pick_pt: Vec3, mode: &LenMode) -> Option<Ent
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration { names: &["LEN", "LENGTHEN"] }); // LengthenCommand
inventory::submit!(crate::command::CommandRegistration { names: &["LENGTHEN"] }); // LengthenCommand
+1 -1
View File
@@ -816,7 +816,7 @@ impl CadCommand for OffsetCommand {
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration { names: &["O", "OFFSET"] }); // OffsetCommand
inventory::submit!(crate::command::CommandRegistration { names: &["OFFSET"] }); // OffsetCommand
#[cfg(test)]
mod offset_tests {
+1 -1
View File
@@ -185,4 +185,4 @@ pub fn apply_pedit(entity: &mut EntityType, op: &PeditOp) -> bool {
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration { names: &["PE", "PEDIT"] }); // PeditCommand
inventory::submit!(crate::command::CommandRegistration { names: &["PEDIT"] }); // PeditCommand
+1 -1
View File
@@ -203,4 +203,4 @@ pub fn apply_spline_op(doc: &mut acadrust::CadDocument, handle: acadrust::Handle
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration { names: &["SPE", "SPLINEDIT"] }); // SplineditCommand
inventory::submit!(crate::command::CommandRegistration { names: &["SPLINEDIT"] }); // SplineditCommand
+2 -2
View File
@@ -2751,8 +2751,8 @@ impl CadCommand for ExtendCommand {
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration { names: &["EX", "EXTEND"] }); // ExtendCommand
inventory::submit!(crate::command::CommandRegistration { names: &["TR", "TRIM"] }); // TrimCommand
inventory::submit!(crate::command::CommandRegistration { names: &["EXTEND"] }); // ExtendCommand
inventory::submit!(crate::command::CommandRegistration { names: &["TRIM"] }); // TrimCommand
#[cfg(test)]
mod tests {