From 52c91e428b2ea71fe6c89cf2c0b272fc4243db22 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 29 Jan 2024 15:57:54 +0100 Subject: [PATCH] Turn off text wrapping by default in combo-box popups --- crates/egui/src/containers/combo_box.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/egui/src/containers/combo_box.rs b/crates/egui/src/containers/combo_box.rs index 44950924724..828ee140aa5 100644 --- a/crates/egui/src/containers/combo_box.rs +++ b/crates/egui/src/containers/combo_box.rs @@ -365,7 +365,15 @@ fn combo_box_dyn<'c, R>( |ui| { ScrollArea::vertical() .max_height(height) - .show(ui, menu_contents) + .show(ui, |ui| { + // Often the button is very narrow, which means this popup + // is also very narrow. Having wrapping on would therefore + // result in labels that wrap very early. + // Instead, we turn it off by default so that the labels + // expand the width of the menu. + ui.style_mut().wrap = Some(false); + menu_contents(ui) + }) .inner }, );