Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Use `when_else()`
Joseph T. Lyonsee45db8a78cb
diff --git a/crates/ui2/src/components/keybinding.rs b/crates/ui2/src/components/keybinding.rsindex c4054fa1a43..29586fd1941 100644--- a/crates/ui2/src/components/keybinding.rs+++ b/crates/ui2/src/components/keybinding.rs@@ -98,10 +98,11 @@ impl RenderOnce for Key {div().py_0()- .when(single_char, |el| {- el.w(rems(14. / 16.)).flex().flex_none().justify_center()- })- .when(!single_char, |el| el.px_0p5())+ .when_else(+ single_char,+ |el| el.w(rems(14. / 16.)).flex().flex_none().justify_center(),+ |el| el.px_0p5(),+ ).h(rems(14. / 16.)).text_ui().line_height(relative(1.))