Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
editor: Fix selection and bracket pair highlight not appearing on collab updates (#29558)
Smit Barmase2139219832e3
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex bd55083bd70..6b253c1b747 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -2623,7 +2623,7 @@ impl Editor {}self.refresh_code_actions(window, cx);self.refresh_document_highlights(cx);- self.refresh_selected_text_highlights(window, cx);+ self.refresh_selected_text_highlights(false, window, cx);refresh_matching_bracket_highlights(self, window, cx);self.update_visible_inline_completion(window, cx);self.edit_prediction_requires_modifier_in_indent_conflict = true;@@ -5817,7 +5817,12 @@ impl Editor {})}- fn refresh_selected_text_highlights(&mut self, window: &mut Window, cx: &mut Context<Editor>) {+ fn refresh_selected_text_highlights(+ &mut self,+ on_buffer_edit: bool,+ window: &mut Window,+ cx: &mut Context<Editor>,+ ) {let Some((query_text, query_range)) = self.prepare_highlight_query_from_selection(cx)else {self.clear_background_highlights::<SelectedTextHighlight>(cx);@@ -5826,12 +5831,13 @@ impl Editor {return;};let multi_buffer_snapshot = self.buffer().read(cx).snapshot(cx);- if self- .quick_selection_highlight_task- .as_ref()- .map_or(true, |(prev_anchor_range, _)| {- prev_anchor_range != &query_range- })+ if on_buffer_edit+ || self+ .quick_selection_highlight_task+ .as_ref()+ .map_or(true, |(prev_anchor_range, _)| {+ prev_anchor_range != &query_range+ }){let multi_buffer_visible_start = self.scroll_manager@@ -5856,12 +5862,13 @@ impl Editor {),));}- if self- .debounced_selection_highlight_task- .as_ref()- .map_or(true, |(prev_anchor_range, _)| {- prev_anchor_range != &query_range- })+ if on_buffer_edit+ || self+ .debounced_selection_highlight_task+ .as_ref()+ .map_or(true, |(prev_anchor_range, _)| {+ prev_anchor_range != &query_range+ }){let multi_buffer_start = multi_buffer_snapshot.anchor_before(0)@@ -17749,6 +17756,8 @@ impl Editor {self.active_indent_guides_state.dirty = true;self.refresh_active_diagnostics(cx);self.refresh_code_actions(window, cx);+ self.refresh_selected_text_highlights(true, window, cx);+ refresh_matching_bracket_highlights(self, window, cx);if self.has_active_inline_completion() {self.update_visible_inline_completion(window, cx);}