editor: Fix selection and bracket pair highlight not appearing on collab updates (#29558)
This PR fixes bug where selection and bracket pair highlights would not update when new text was added via collab. Release Notes: - Fixed an issue where selection and bracket pair highlights would not update when new text was added via collab. --------- Co-authored-by: Ben Kunkle <ben@zed.dev>
This commit is contained in:
parent
9abeedf0c6
commit
2139219832
1 changed files with 23 additions and 14 deletions
|
@ -2623,7 +2623,7 @@ impl Editor {
|
||||||
}
|
}
|
||||||
self.refresh_code_actions(window, cx);
|
self.refresh_code_actions(window, cx);
|
||||||
self.refresh_document_highlights(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);
|
refresh_matching_bracket_highlights(self, window, cx);
|
||||||
self.update_visible_inline_completion(window, cx);
|
self.update_visible_inline_completion(window, cx);
|
||||||
self.edit_prediction_requires_modifier_in_indent_conflict = true;
|
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)
|
let Some((query_text, query_range)) = self.prepare_highlight_query_from_selection(cx)
|
||||||
else {
|
else {
|
||||||
self.clear_background_highlights::<SelectedTextHighlight>(cx);
|
self.clear_background_highlights::<SelectedTextHighlight>(cx);
|
||||||
|
@ -5826,12 +5831,13 @@ impl Editor {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let multi_buffer_snapshot = self.buffer().read(cx).snapshot(cx);
|
let multi_buffer_snapshot = self.buffer().read(cx).snapshot(cx);
|
||||||
if self
|
if on_buffer_edit
|
||||||
.quick_selection_highlight_task
|
|| self
|
||||||
.as_ref()
|
.quick_selection_highlight_task
|
||||||
.map_or(true, |(prev_anchor_range, _)| {
|
.as_ref()
|
||||||
prev_anchor_range != &query_range
|
.map_or(true, |(prev_anchor_range, _)| {
|
||||||
})
|
prev_anchor_range != &query_range
|
||||||
|
})
|
||||||
{
|
{
|
||||||
let multi_buffer_visible_start = self
|
let multi_buffer_visible_start = self
|
||||||
.scroll_manager
|
.scroll_manager
|
||||||
|
@ -5856,12 +5862,13 @@ impl Editor {
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if self
|
if on_buffer_edit
|
||||||
.debounced_selection_highlight_task
|
|| self
|
||||||
.as_ref()
|
.debounced_selection_highlight_task
|
||||||
.map_or(true, |(prev_anchor_range, _)| {
|
.as_ref()
|
||||||
prev_anchor_range != &query_range
|
.map_or(true, |(prev_anchor_range, _)| {
|
||||||
})
|
prev_anchor_range != &query_range
|
||||||
|
})
|
||||||
{
|
{
|
||||||
let multi_buffer_start = multi_buffer_snapshot
|
let multi_buffer_start = multi_buffer_snapshot
|
||||||
.anchor_before(0)
|
.anchor_before(0)
|
||||||
|
@ -17749,6 +17756,8 @@ impl Editor {
|
||||||
self.active_indent_guides_state.dirty = true;
|
self.active_indent_guides_state.dirty = true;
|
||||||
self.refresh_active_diagnostics(cx);
|
self.refresh_active_diagnostics(cx);
|
||||||
self.refresh_code_actions(window, 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() {
|
if self.has_active_inline_completion() {
|
||||||
self.update_visible_inline_completion(window, cx);
|
self.update_visible_inline_completion(window, cx);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue