diff --git a/crates/editor/src/lib.rs b/crates/editor/src/lib.rs index 7cccd0438a..4a1f6392e4 100644 --- a/crates/editor/src/lib.rs +++ b/crates/editor/src/lib.rs @@ -670,8 +670,10 @@ impl Editor { } fn end_selection(&mut self, cx: &mut ViewContext) { - let selections = self.selections::(cx).collect::>(); - self.update_selections(selections, false, cx); + if self.pending_selection.is_some() { + let selections = self.selections::(cx).collect::>(); + self.update_selections(selections, false, cx); + } } pub fn is_selecting(&self) -> bool { @@ -2404,7 +2406,8 @@ impl Editor { cx.notify(); } - fn start_transaction(&self, cx: &mut ViewContext) { + fn start_transaction(&mut self, cx: &mut ViewContext) { + self.end_selection(cx); self.buffer.update(cx, |buffer, _| { buffer .start_transaction(Some(self.selection_set_id))