feat(commands): prompt the single-value settings step by step

Bare CLAYER / CDIMSTY / COLOR / LWDISPLAY / ISAVEBAK / FILEASSOC /
SAVETIME / ANNOSCALE printed the current value or a usage line and
stopped; only the fully-typed `NAME <value>` form set anything. Route the
bare form through ValuePromptCommand (the pattern LTSCALE / PDMODE / PDSIZE
already use): it prompts for the value and re-dispatches `NAME <value>` to
the existing inline handler, so the set/get logic stays in one place. The
bare-Enter getter is preserved — ValuePromptCommand dispatches `NAME `,
which the argument arm reports the current value for (added that empty
case to ISAVEBAK / FILEASSOC / SAVETIME, which previously errored on it).
COLOR keeps BYLAYER as an immediate shortcut rather than a prompt.

USERR / USERI are left as-is: they take two inputs (register 1-5 + value),
so they need a two-step command rather than the single-value prompt.
This commit is contained in:
Hakan Seven 2026-07-16 13:00:10 +03:00
commit 5f1019edec
2 changed files with 79 additions and 24 deletions

View file

@ -688,11 +688,16 @@ impl OpenCADStudio {
// ANNOSCALE / CANNOSCALE <ratio> — set the current annotation scale
// (e.g. 1:50, 2:1, or a plain factor). Drives annotative-object size
// in model space and is written to the drawing header.
cmd if cmd == "ANNOSCALE"
|| cmd == "CANNOSCALE"
|| cmd.starts_with("ANNOSCALE ")
|| cmd.starts_with("CANNOSCALE ") =>
{
"ANNOSCALE" | "CANNOSCALE" => {
use crate::command::ValuePromptCommand;
let c = ValuePromptCommand::new(
"ANNOSCALE",
"ANNOSCALE new annotation scale (e.g. 1:50, 2:1, or a factor):",
);
self.command_line.push_info(&c.prompt());
self.tabs[i].active_cmd = Some(Box::new(c));
}
cmd if cmd.starts_with("ANNOSCALE ") || cmd.starts_with("CANNOSCALE ") => {
let arg = cmd
.split_whitespace()
.nth(1)