Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui: Further fix extraction of font runs from text runs (#43856)

Mikko Perttunend1d419b20925
diff --git a/crates/gpui/src/text_system.rs b/crates/gpui/src/text_system.rs
index 39f68e3226a..070e434dc99 100644
--- a/crates/gpui/src/text_system.rs
+++ b/crates/gpui/src/text_system.rs
@@ -550,7 +550,6 @@ impl WindowTextSystem {
force_width: Option<Pixels>,
) -> Arc<LineLayout> {
let mut last_run = None::<&TextRun>;
- let mut last_font: Option<FontId> = None;
let mut font_runs = self.font_runs_pool.lock().pop().unwrap_or_default();
font_runs.clear();
@@ -568,14 +567,13 @@ impl WindowTextSystem {
true
};
+ let font_id = self.resolve_font(&run.font);
if let Some(font_run) = font_runs.last_mut()
- && Some(font_run.font_id) == last_font
+ && font_id == font_run.font_id
&& !decoration_changed
{
font_run.len += run.len;
} else {
- let font_id = self.resolve_font(&run.font);
- last_font = Some(font_id);
font_runs.push(FontRun {
len: run.len,
font_id,