Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
editor: Ensure placeholder text wraps properly after font size change (#37992)
Finn Eversd7f3d08c5934
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex f2d5fd5762b..c5ea6d4ee20 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -18911,14 +18911,15 @@ impl Editor {// so that wrapping is not recalculated and stays consistent for the editor// and its linked minimap.if !self.mode.is_minimap() {- let rem_size = window.rem_size();- self.display_map.update(cx, |map, cx| {- map.set_font(- style.text.font(),- style.text.font_size.to_pixels(rem_size),- cx,- )- });+ let font = style.text.font();+ let font_size = style.text.font_size.to_pixels(window.rem_size());+ let display_map = self+ .placeholder_display_map+ .as_ref()+ .filter(|_| self.is_empty(cx))+ .unwrap_or(&self.display_map);++ display_map.update(cx, |map, cx| map.set_font(font, font_size, cx));}self.style = Some(style);}