From 11a3b8c5ce517c3a22ff9f5eecd079c7072e34dd Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 2 Jun 2021 12:13:08 +0200 Subject: [PATCH] Don't increment clock for initial insertion --- zed/src/editor/buffer.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/zed/src/editor/buffer.rs b/zed/src/editor/buffer.rs index cb0b68c2a7..f9e061030f 100644 --- a/zed/src/editor/buffer.rs +++ b/zed/src/editor/buffer.rs @@ -462,12 +462,10 @@ impl Buffer { let mut fragments = SumTree::new(); let visible_text = Rope::from(history.base_text.as_ref()); - let mut local_clock = time::Local::new(replica_id); - if visible_text.len() > 0 { fragments.push( Fragment { - insertion_id: local_clock.tick(), + insertion_id: Default::default(), len: visible_text.len(), deletions: Default::default(), max_undos: Default::default(), @@ -496,7 +494,7 @@ impl Buffer { deferred_ops: OperationQueue::new(), deferred_replicas: HashSet::default(), replica_id, - local_clock, + local_clock: time::Local::new(replica_id), lamport_clock: time::Lamport::new(replica_id), }; result.reparse(cx);