Text fields: opening at the start is an opt-in (TextField::open_at_start), set by form dialog multi-line rows

94cfd1df0 opened every multi-line field a layer opens on at its start, which broke the comment composer's whole-text selection (review note_popup trial). Only form dialog rows ask for it now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dylan M. TaylorandClaude Opus 5.5 committed 2026-11-30 00:31:09 +00:00
1 parent 6437352362
commit e356d38cd3
4 files changed
+16 -3

No files matched your search

+3 -2
View File
@@ -620,8 +620,9 @@ fn arrive(ctx: &egui::Context, widget: egui::Id, decl: &TextPart, state: &mut Te
state.select_on_click = true;
return;
}
// A multi-line field opens on its first line with nothing selected, so the text reads from its start.
if opened && !select_all && decl.options.multiline() {
// A multi-line field that asks for it (`open_at_start`) opens on its first line with nothing selected, so the text
// reads from its start.
if opened && !select_all && decl.options.open_at_start && decl.options.multiline() {
adapter::select(ctx, widget, 0, 0);
return;
}
@@ -115,6 +115,9 @@ pub struct TextOptions {
/// A layer that opens on the field (`FocusOrigin::Open`) leaves the caret where the codec's rule puts it instead
/// of selecting the whole text: a field that opens to add to its text (an edited comment) rather than replace it.
pub keep_caret_on_open: bool,
/// A layer that opens on this multi-line field puts the caret at its start with nothing selected, so the text
/// reads from its first line (a form dialog's multi-line row).
pub open_at_start: bool,
/// Selects the current text before this pass's typing, unless an IME composition is active.
pub select_all: bool,
/// Enter does something in the field itself (it saves or runs a search): the field takes the `Submit` intent, so the
@@ -198,6 +201,7 @@ impl Default for TextOptions {
steps_value: false,
select_on_focus: false,
keep_caret_on_open: false,
open_at_start: false,
select_all: false,
submits: false,
mixed: false,
@@ -1560,7 +1560,7 @@ impl<'p> Pass<'p> {
let mut field = TextField::new(line.name.clone(), line.bind(value.clone(), Some(default.to_owned()))).id_salt("text");
let options = line.param.option();
if let Some(lines) = options.lines() {
field = field.lines(lines);
field = field.lines(lines).open_at_start();
}
if let Some(max) = options.max_chars() {
field = field.limit(Some(max));
+8
View File
@@ -211,6 +211,14 @@ impl<'a, C: Codec + Clone + 'static> TextField<'a, C> {
self
}
/// A layer that opens on this multi-line field puts its caret at the start with nothing selected, so the text
/// reads from its first line. Off by default: an opening layer selects the whole text.
#[must_use]
pub fn open_at_start(mut self) -> Self {
self.options.open_at_start = true;
self
}
/// With `on`, selects the whole text in this pass, so typing replaces it, unless the field is composing text; a
/// request made during a composition is dropped.
#[must_use]