fix(input): honor @ / # coordinate prefixes during dynamic input

While DYN fields were showing, a leading @ or # landed in the command
line but the following digits were captured by the focused DYN field,
splitting the value so the prefix never resolved. Treat a leading @ / #
as an escape: route the whole coordinate (digits and separators) to the
command line so the relative (@) / absolute (#) prefix works the same
whether DYN is on or off.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-15 13:31:25 +03:00
commit df616482e2

View file

@ -1033,7 +1033,19 @@ impl OpenCADStudio {
// reshaping the field set when going polar → cartesian
// (Distance → X, Y) or 2-D → 3-D (X, Y → X, Y, Z).
// See #35.
if s == "," && self.dyn_input && !self.tabs[i].dyn_fields.is_empty() {
// A leading `@` / `#` escapes dynamic-input capture: the
// whole coordinate is typed into the command line so the
// prefix's relative / absolute meaning is honoured even
// while DYN fields are showing. Without this, the prefix
// lands in the command line while the digits go to a DYN
// field, splitting the value.
let coord_prefix_escape = self.command_line.input.starts_with('@')
|| self.command_line.input.starts_with('#');
if s == ","
&& self.dyn_input
&& !self.tabs[i].dyn_fields.is_empty()
&& !coord_prefix_escape
{
self.dyn_comma_advance();
self.command_line.autocomplete_cursor = None;
return self.focus_cmd_input();
@ -1047,7 +1059,11 @@ impl OpenCADStudio {
c.is_ascii_digit()
|| matches!(c, '.' | '-' | '+' | '*' | '/' | '^' | '%' | '(' | ')')
});
if dyn_field_char && self.dyn_input && !self.tabs[i].dyn_fields.is_empty() {
if dyn_field_char
&& self.dyn_input
&& !self.tabs[i].dyn_fields.is_empty()
&& !coord_prefix_escape
{
let a = self.tabs[i]
.dyn_active
.min(self.tabs[i].dyn_fields.len() - 1);