Skip to content

Commit

Permalink
Fix TextEdit being too short whenever there is horizontal margin (e…
Browse files Browse the repository at this point in the history
…milk#4005)

The allocated width is reduced by the horizontal margin inside
`show_content` but the margin is already factored into the content_ui's
rect.
This causes both text and frame (not shown here) to be `2.0 * margin.x`
too short.

Before:

![image](https://github.com/emilk/egui/assets/23122431/6a9a0264-3fc0-48b7-b462-82120ed47fcf)

After:

![image-1](https://github.com/emilk/egui/assets/23122431/ffef9edc-d571-4fca-96cf-c2e42e2f0057)
(*The blue rect is the TextEdit's (expected) final size.)

Co-authored-by: Georg Weisert <georg.weisert@freshx.de>
  • Loading branch information
2 people authored and bu5hm4nn committed Feb 15, 2024
1 parent f954e98 commit b6607bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/egui/src/widgets/text_edit/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ impl<'t> TextEdit<'t> {
available_width
} else {
desired_width.min(available_width)
} - margin.x * 2.0;
};

let font_id_clone = font_id.clone();
let mut default_layouter = move |ui: &Ui, text: &str, wrap_width: f32| {
Expand Down

0 comments on commit b6607bd

Please sign in to comment.