diff --git a/crates/ui-contract/src/runtime/egui/text_edit.rs b/crates/ui-contract/src/runtime/egui/text_edit.rs index 4119e05aa..88788a99d 100644 --- a/crates/ui-contract/src/runtime/egui/text_edit.rs +++ b/crates/ui-contract/src/runtime/egui/text_edit.rs @@ -228,6 +228,13 @@ pub(crate) fn show(ui: &mut Ui, edit: Edit<'_>) -> Shown { } shown }; + // A multi-line text taller than its part scrolls inside it: the part is the view, and the text, which the clip + // above cuts to the view, the content (S-L186: the text adapter owns the offset). + if multiline && galley.is_none() && output.response.rect.height() > rect.height() { + let text_rect = egui::Rect::from_min_size(output.galley_pos, output.galley.rect.size()); + let content = placed.union(output.response.rect).union(text_rect); + super::widgets::note_scroll_region(ui.ctx(), rect.intersect(ui.clip_rect()), content); + } let focused = output.response.has_focus(); let caret = output.cursor_range.map(|range| { let at = output.galley.pos_from_cursor(range.primary); diff --git a/crates/ui-widgets/src/text/text_field.rs b/crates/ui-widgets/src/text/text_field.rs index 94ea1a261..93418ebed 100644 --- a/crates/ui-widgets/src/text/text_field.rs +++ b/crates/ui-widgets/src/text/text_field.rs @@ -328,12 +328,6 @@ impl Component for TextField<'_, C> { let tall = cx.layout(&TextRun::new(shown).role(self.options.role).wrap(Wrap::Wrap)).size().y; let rows = if line > 0.0 { (tall / line).round() as usize } else { 1 }; size.y = size.y.max(height(lines.max(rows))); - if self.max_lines.is_some() { - eprintln!( - "DIAG a_capped_field_grows_to_its_lines_then_scrolls_with_the_caret_in_view: measure line={line} tall={tall} rows={rows} room={:?} size_y={}", - cx.room, size.y - ); - } if let Some(most) = self.max_lines { size.y = size.y.min(height(most.max(lines))); }