From 781aa92f26629c1eabd5521524396367af319b1f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 17 May 2021 10:32:59 +0200 Subject: [PATCH] Don't summarize unnecessary information when resolving anchor --- zed/src/editor/buffer/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/zed/src/editor/buffer/mod.rs b/zed/src/editor/buffer/mod.rs index 6bbebbbf26..27044e1dfe 100644 --- a/zed/src/editor/buffer/mod.rs +++ b/zed/src/editor/buffer/mod.rs @@ -1900,15 +1900,13 @@ impl Buffer { .item() .ok_or_else(|| anyhow!("split offset is out of range"))?; - let mut fragments_cursor = self - .fragments - .cursor::(); + let mut fragments_cursor = self.fragments.cursor::(); fragments_cursor.seek(&FragmentIdRef::new(&split.fragment_id), SeekBias::Left, &()); let fragment = fragments_cursor .item() .ok_or_else(|| anyhow!("fragment id does not exist"))?; - let mut ix = fragments_cursor.start().clone().visible; + let mut ix = *fragments_cursor.start(); if fragment.visible { ix += offset - fragment.range_in_insertion.start; } @@ -2316,7 +2314,7 @@ impl Default for InsertionSplitSummary { impl<'a> sum_tree::Dimension<'a, InsertionSplitSummary> for usize { fn add_summary(&mut self, summary: &InsertionSplitSummary) { - *self += &summary.extent; + *self += summary.extent; } }