Module name_field
Expand description
A one-line, in-place text field for naming something.
Both history surfaces need the same small thing: a field that appears where the name will live, takes the keyboard while it is up, commits on Enter and abandons on Escape. The activity pane grows it inside a band header; the word processor’s strip grows it in the button row. Writing it twice would mean two sets of key handling, two truncation rules, and two carets that drift apart — so it is one primitive.
It is not a general-purpose text input: no selection, no clipboard, no
caret movement — those belong to TextInput,
which is far too much machinery for a label a user types once. Its typing,
grapheme-wise Backspace and IME composition still go through the shared
EditCore, so it erases and composes exactly like every other field.
What this does have is the behaviour a name field must not get wrong:
- It keeps the tail visible when the text outruns the box, because what the user is typing is at the end.
- Enter and Escape are consumed, so a host cannot accidentally also act on them.
- An empty commit is reported as an empty string rather than swallowed: over an existing name that means “remove it”, and only the host knows whether there is one.
Structs§
- Name
Field - A one-line name field. Hosts own the placement and the lifetime; this owns the text and the keys.
Enums§
- Name
Field Outcome - What a key did to the field.