forked from 1b-agent/opencadstudio-upstream
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:
1 parent
24f7329468
commit
a24232842c
3 files changed
+31
-1
No files matched your search
@@ -178,6 +178,17 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
};
|
||||
return self.dispatch_command(&format!("VPORTS {cfg}"));
|
||||
}
|
||||
// Interactive system-variable value: after a bare `MIRRTEXT`
|
||||
// (etc.) the next entry is the new value; empty Enter keeps the
|
||||
// current setting.
|
||||
if let Some(name) = self.pending_setvar.take() {
|
||||
let val = self.command_line.input.trim().to_string();
|
||||
self.command_line.input.clear();
|
||||
if val.is_empty() {
|
||||
return Task::none();
|
||||
}
|
||||
return self.dispatch_command(&format!("SETVAR {name} {val}"));
|
||||
}
|
||||
// If the user navigated the autocomplete list with the
|
||||
// arrow keys, Enter dispatches the highlighted command
|
||||
// rather than the partial text actually in the buffer.
|
||||
@@ -414,6 +425,11 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
if self.pane_move_from.take().is_some() {
|
||||
return Task::none();
|
||||
}
|
||||
// Esc cancels a pending system-variable value prompt.
|
||||
if self.pending_setvar.take().is_some() {
|
||||
self.command_line.push_info("*Cancel*");
|
||||
return Task::none();
|
||||
}
|
||||
// UCS icon: Esc ends any grip drag and clears the selection
|
||||
// (only when no command owns Escape).
|
||||
if self.tabs[self.active_tab].active_cmd.is_none()
|
||||
|
||||
Reference in new issue
Block a user