diff --git a/zed/src/editor/buffer/rope.rs b/zed/src/editor/buffer/rope.rs index 994022deeeafb69000f2d5ab4556a953c4b6a3ea..78ed1563087097b624914f5d4aae504dee88088b 100644 --- a/zed/src/editor/buffer/rope.rs +++ b/zed/src/editor/buffer/rope.rs @@ -26,8 +26,12 @@ impl Rope { let mut chunks = rope.chunks.cursor::<(), ()>(); chunks.next(); if let Some(chunk) = chunks.item() { - self.push(&chunk.0); - chunks.next(); + if self.chunks.last().map_or(false, |c| c.0.len() < CHUNK_BASE) + || chunk.0.len() < CHUNK_BASE + { + self.push(&chunk.0); + chunks.next(); + } } self.chunks.push_tree(chunks.suffix(&()), &());