From ee4a48f70d09dbaa52e928fc0d4abbae677d962d Mon Sep 17 00:00:00 2001 From: Smit Barmase Date: Mon, 13 Oct 2025 20:54:49 +0530 Subject: [PATCH] check offset instead of anchor --- crates/editor/src/editor.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 848e9c76f6fd6e8d9ed2df60daa611799f51ff29..133b9074ae18593befc9782acda4feeb7ec55a51 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -1090,8 +1090,8 @@ pub struct Editor { next_completion_id: CompletionId, available_code_actions: Option<(Location, Rc<[AvailableCodeAction]>)>, code_actions_task: Option>>, - quick_selection_highlight_task: Option<(Range, Task<()>)>, - debounced_selection_highlight_task: Option<(Range, Task<()>)>, + quick_selection_highlight_task: Option<(Range, Task<()>)>, + debounced_selection_highlight_task: Option<(Range, Task<()>)>, document_highlights_task: Option>, linked_editing_range_task: Option>>, linked_edit_ranges: linked_editing_ranges::LinkedEditingRanges, @@ -7128,11 +7128,12 @@ impl Editor { return; }; let multi_buffer_snapshot = self.buffer().read(cx).snapshot(cx); + let query_offset = query_range.to_offset(&multi_buffer_snapshot); if on_buffer_edit || self .quick_selection_highlight_task .as_ref() - .is_none_or(|(prev_anchor_range, _)| prev_anchor_range != &query_range) + .is_none_or(|(prev_query_offset, _)| prev_query_offset != &query_offset) { let multi_buffer_visible_start = self .scroll_manager @@ -7146,7 +7147,7 @@ impl Editor { ); let multi_buffer_visible_range = multi_buffer_visible_start..multi_buffer_visible_end; self.quick_selection_highlight_task = Some(( - query_range.clone(), + query_offset.clone(), self.update_selection_occurrence_highlights( query_text.clone(), query_range.clone(), @@ -7161,7 +7162,7 @@ impl Editor { || self .debounced_selection_highlight_task .as_ref() - .is_none_or(|(prev_anchor_range, _)| prev_anchor_range != &query_range) + .is_none_or(|(prev_query_offset, _)| prev_query_offset != &query_offset) { let multi_buffer_start = multi_buffer_snapshot .anchor_before(0) @@ -7171,7 +7172,7 @@ impl Editor { .to_point(&multi_buffer_snapshot); let multi_buffer_full_range = multi_buffer_start..multi_buffer_end; self.debounced_selection_highlight_task = Some(( - query_range.clone(), + query_offset, self.update_selection_occurrence_highlights( query_text, query_range,