summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Weisert <weisert@stud.uni-heidelberg.de>2024-02-10 09:36:24 +0100
committerEmil Ernerfeldt <emil.ernerfeldt@gmail.com>2024-02-10 17:51:09 +0100
commitdb00dc6ea546ab67070056f749c912eea33c2709 (patch)
tree35ff6b0b39c7bd997ce0deeba6cb4883a2371298
parent820a3baf3017c2f84c062850159be8c819e5112b (diff)
Fix `TextEdit` being too short whenever there is horizontal margin (#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>
-rw-r--r--crates/egui/src/widgets/text_edit/builder.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/egui/src/widgets/text_edit/builder.rs b/crates/egui/src/widgets/text_edit/builder.rs
index 9ee17bac..080d7705 100644
--- a/crates/egui/src/widgets/text_edit/builder.rs
+++ b/crates/egui/src/widgets/text_edit/builder.rs
@@ -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| {