Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
windows: Remove extra empty line when loading default settings (#30344)
张小白d8980c25d283
diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rsindex e2721acda61..0dd1f605f7c 100644--- a/crates/fs/src/fs.rs+++ b/crates/fs/src/fs.rs@@ -2340,15 +2340,19 @@ impl Fs for FakeFs {fn chunks(rope: &Rope, line_ending: LineEnding) -> impl Iterator<Item = &str> {rope.chunks().flat_map(move |chunk| {let mut newline = false;- chunk.split('\n').flat_map(move |line| {- let ending = if newline {- Some(line_ending.as_str())- } else {- None- };- newline = true;- ending.into_iter().chain([line])- })+ let end_with_newline = chunk.ends_with('\n').then_some(line_ending.as_str());+ chunk+ .lines()+ .flat_map(move |line| {+ let ending = if newline {+ Some(line_ending.as_str())+ } else {+ None+ };+ newline = true;+ ending.into_iter().chain([line])+ })+ .chain(end_with_newline)})}