feat(commands): prompt for a system-variable value on the next line

Typing a bare system-variable name (MIRRTEXT, FILLMODE, LTSCALE, …) now
echoes the current value and prompts "Enter new value for <NAME> <cur>:",
capturing the next command-line entry as the new value — Enter keeps the
current one, Escape cancels. The single-line "MIRRTEXT 1" form still works.
Mirrors the awaiting_vports pattern: a pending_setvar field on the app,
consumed at the top of on_command_submit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-03 12:42:55 +03:00
commit a24232842c
3 changed files with 31 additions and 1 deletions

View file

@ -1213,8 +1213,17 @@ impl OpenCADStudio {
Ok((msg, changed)) => {
if changed {
self.tabs[i].dirty = true;
self.command_line.push_output(&msg);
} else {
// Queried with no value (`changed == false`):
// prompt for a new value on the next line instead
// of only echoing the current one. Enter keeps it.
let current = msg.split('=').nth(1).map(str::trim).unwrap_or("");
self.command_line.push_output(&format!(
"Enter new value for {name} <{current}>:"
));
self.pending_setvar = Some(name.clone());
}
self.command_line.push_output(&msg);
}
Err(e) => self.command_line.push_error(&e),
}