From 125be2f07a1a786661740d99ce0b65348437c899 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 4 Jun 2021 13:42:37 +0200 Subject: [PATCH] Save an allocation when editing locally --- zed/src/editor/buffer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zed/src/editor/buffer.rs b/zed/src/editor/buffer.rs index b00bb9fb02..49675a6dd3 100644 --- a/zed/src/editor/buffer.rs +++ b/zed/src/editor/buffer.rs @@ -1445,8 +1445,7 @@ impl Buffer { id: local_timestamp, version: self.version(), ranges: Vec::with_capacity(ranges.len()), - // TODO: avoid cloning here - new_text: new_text.clone(), + new_text: None, }; let mut new_ropes = @@ -1555,6 +1554,7 @@ impl Buffer { self.fragments = new_fragments; self.visible_text = visible_text; self.deleted_text = deleted_text; + edit.new_text = new_text; edit }