feat(userreg): prompt USERI/USERR for register then value

USERI/USERR set one of five integer/real header registers and needed both
inputs (register + value) typed on one line; bare printed usage. Add a
two-step front-end (UserRegCommand): it prompts for the register as 1–5
buttons, then the value, and dispatches USERI/USERR <n> <value> to the
existing inline handler. The argument arm now requires a space so the bare
name reaches the stepped command.
This commit is contained in:
Hakan Seven 2026-07-16 13:14:37 +03:00
commit 1533c66a3e
2 changed files with 79 additions and 1 deletions

View file

@ -135,7 +135,14 @@ impl OpenCADStudio {
// even though we don't have a LISP / DIESEL runtime yet.
// USERI 1 42 → header.user_int1 = 42
// USERR 3 1.5e-3 → header.user_real3 = 0.0015
cmd if cmd.starts_with("USERI") || cmd.starts_with("USERR") => {
"USERI" | "USERR" => {
use crate::command::UserRegCommand;
let name = if cmd == "USERR" { "USERR" } else { "USERI" };
let c = UserRegCommand::new(name);
self.command_line.push_info(&c.prompt());
self.tabs[i].active_cmd = Some(Box::new(c));
}
cmd if cmd.starts_with("USERI ") || cmd.starts_with("USERR ") => {
let is_real = cmd.starts_with("USERR");
let rest = if is_real {
cmd.trim_start_matches("USERR").trim()