diff --git a/crates/egui/src/theme/default_style.rs b/crates/egui/src/theme/default_style.rs index 8c6e2cc21..e4cb8d9d3 100644 --- a/crates/egui/src/theme/default_style.rs +++ b/crates/egui/src/theme/default_style.rs @@ -157,6 +157,10 @@ impl StyleProvider for DefaultStyle { outer_margin: Margin::same(-(widget_visuals.expansion as i8)), ..Default::default() }, + // A text edit sizes itself from the rows it holds; egui's own theme adds no floor + // of its own. + min_size: Vec2::ZERO, + gap: style.spacing.icon_spacing, text_style: text, ..Default::default() }, diff --git a/crates/egui/src/widgets/text_edit/builder.rs b/crates/egui/src/widgets/text_edit/builder.rs index 3742d4b75..66c08e6c2 100644 --- a/crates/egui/src/widgets/text_edit/builder.rs +++ b/crates/egui/src/widgets/text_edit/builder.rs @@ -494,12 +494,18 @@ impl TextEdit<'_> { atom_layout: AtomLayoutStyle { frame: styled_frame, + min_size: style_min_size, + gap, text_style: text_visuals, .. }, hint_text_color, } = ui.widget_style(id, &classes); + // The theme sets a floor on the size; the builder's own `min_size` can only raise it, + // the same way it does for a button. + let min_size = min_size.max(style_min_size); + let text_color = text_color .or_else(|| ui.visuals().override_text_color) .unwrap_or(text_visuals.color); @@ -743,6 +749,7 @@ impl TextEdit<'_> { let allocated = AtomLayout::new(atoms) .id(id) + .fallback_gap(gap) .min_size(Vec2::new(allocate_width, min_height.at_least(min_size.y))) .max_width(allocate_width) .sense(sense)