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.

Consume newline from run if it spans it

Antonio Scandurraf227c3284de3
diff --git a/crates/gpui2/src/text_system.rs b/crates/gpui2/src/text_system.rs
index 76e21e5f733..440789dd472 100644
--- a/crates/gpui2/src/text_system.rs
+++ b/crates/gpui2/src/text_system.rs
@@ -290,7 +290,15 @@ impl TextSystem {
text: SharedString::from(line_text),
});
- line_start = line_end + 1; // Skip `\n` character.
+ // Skip `\n` character.
+ line_start = line_end + 1;
+ if let Some(run) = runs.peek_mut() {
+ run.len = run.len.saturating_sub(1);
+ if run.len == 0 {
+ runs.next();
+ }
+ }
+
font_runs.clear();
}