feat(cmdline): Space submits, uppercase entry, > for literal spaces
Space now acts like Enter in the command line so commands advance token-by-token (CAD convention). The whole value is handed to the submit path, which tokenises multi-token lines, so a pasted or API-fed `LINE 0,0 10,10` runs each space as a step separator instead of stopping at the first token. A leading `>` switches to literal-space mode (for a text string, a path, etc.) and is stripped on submit. All command-line entry is shown uppercase. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
c45fe0267c
commit
2367bdf47f
2 changed files with 30 additions and 6 deletions
|
|
@ -103,7 +103,8 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
|||
.get_or_insert_with(String::new)
|
||||
.push_str(&s);
|
||||
} else {
|
||||
self.command_line.input.push_str(&s);
|
||||
// Command-line entry is shown uppercase.
|
||||
self.command_line.input.push_str(&s.to_uppercase());
|
||||
}
|
||||
}
|
||||
self.command_line.autocomplete_cursor = None;
|
||||
|
|
@ -140,6 +141,11 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
|||
// dropdown so the dispatched command's new prompt is
|
||||
// immediately visible on the overlay.
|
||||
self.command_line.close_history();
|
||||
// A leading `>` was only a "literal spaces" typing hint (see
|
||||
// CommandSpace) — drop it before the input is interpreted.
|
||||
if self.command_line.input.starts_with('>') {
|
||||
self.command_line.input.remove(0);
|
||||
}
|
||||
// Grip-menu value prompt — consume the typed number and
|
||||
// route it through `apply_grip_menu_value`.
|
||||
if let Some(pending) = self.grip_pending.take() {
|
||||
|
|
|
|||
|
|
@ -707,11 +707,22 @@ impl OpenCADStudio {
|
|||
Message::TabClose(idx) => self.on_tab_close(idx),
|
||||
|
||||
Message::CommandInput(s) => {
|
||||
// Space is a literal character so a whole command line — `UCS Z
|
||||
// 90`, `LINE 0,0 10,10`, `PDMODE 3` — can be typed before Enter.
|
||||
// CommandSubmit (Enter) tokenises and runs the line through the
|
||||
// shared runner. (Unfocused Space still repeats the last command
|
||||
// via CommandSpace.)
|
||||
// Space submits (acts like Enter) so a command advances
|
||||
// token-by-token, matching CAD convention. A leading `>` switches
|
||||
// to literal-space mode so an argument containing spaces (a text
|
||||
// string, a path, `UCS Z 90` as one line) can be typed; the `>`
|
||||
// is stripped on submit. (Unfocused Space repeats the last
|
||||
// command via CommandSpace.)
|
||||
// Command-line entry is shown uppercase.
|
||||
let s = s.to_uppercase();
|
||||
// A space submits (acts like Enter). The whole value is handed to
|
||||
// the submit path, which tokenises multi-token lines — so a typed
|
||||
// token, a pasted `LINE 0,0 10,10`, or API-fed text all run their
|
||||
// spaces as step separators. A leading `>` keeps spaces literal.
|
||||
if !s.starts_with('>') && s.contains(' ') {
|
||||
self.command_line.input = s;
|
||||
return self.update(Message::CommandSubmit);
|
||||
}
|
||||
self.command_line.input = s;
|
||||
// Typing invalidates the previous arrow-key cursor —
|
||||
// the matches list has likely changed.
|
||||
|
|
@ -862,6 +873,13 @@ impl OpenCADStudio {
|
|||
self.mtext_type(" ");
|
||||
return Task::none();
|
||||
}
|
||||
// A leading `>` puts the command line in "literal space" mode so
|
||||
// the user can type arguments that contain spaces; otherwise
|
||||
// Space works like Enter. The `>` is stripped on submit.
|
||||
if self.command_line.input.starts_with('>') {
|
||||
self.command_line.input.push(' ');
|
||||
return Task::none();
|
||||
}
|
||||
return self.update(Message::CommandFinalize);
|
||||
}
|
||||
Message::CommandFinalize => self.on_command_finalize(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue