You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
diagram: Enter in the units field saves a newline into the units #829
The units field in the variable and module details panels is a single-line value, but pressing Enter inserts a newline, and that newline is saved into the variable's units.
The equation and notes editors handle Enter deliberately; the units editor only handles Escape.
Enter in the units field should commit the edit (or do nothing), and pasted multi-line text should be flattened.
Example
Type person hours into a variable's units, put the cursor between the words, press Enter, and click away.
The saved units are person\nhours.
The engine joins multi-word unit names only across spaces and tabs (join_multiword_unit_names in src/simlin-engine/src/units.rs), so this likely no longer parses as the unit person_hours (not checked by running it).
A trailing Enter just leaves a \n in the saved model.
Fix
Add an Enter handler to both units <Editable>s that blurs/commits instead of inserting a line, and a small Slate normalizer that merges blocks so paste is covered too.
Alternatively, strip newlines from the units string when the draft is serialized; simpler, but the user still sees the line break while editing.
Pointers
src/diagram/VariableDetails.tsx (units <Editable>; its comment already notes the gap)
changed the title [-]diagram: units editor accepts Enter, inserting literal newlines into the units string[/-][+]diagram: Enter in the units field saves a newline into the units[/+]on Oct 12, 2026
Activity
[-]diagram: units editor accepts Enter, inserting literal newlines into the units string[/-][+]diagram: Enter in the units field saves a newline into the units[/+]