diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 51435aefe3..cd55b55441 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -5172,13 +5172,16 @@ impl Editor { } fn refresh_code_actions(&mut self, window: &mut Window, cx: &mut Context) -> Option<()> { - let buffer = self.buffer.read(cx); let newest_selection = self.selections.newest_anchor().clone(); + let newest_selection_adjusted = self.selections.newest_adjusted(cx).clone(); + let buffer = self.buffer.read(cx); if newest_selection.head().diff_base_anchor.is_some() { return None; } - let (start_buffer, start) = buffer.text_anchor_for_position(newest_selection.start, cx)?; - let (end_buffer, end) = buffer.text_anchor_for_position(newest_selection.end, cx)?; + let (start_buffer, start) = + buffer.text_anchor_for_position(newest_selection_adjusted.start, cx)?; + let (end_buffer, end) = + buffer.text_anchor_for_position(newest_selection_adjusted.end, cx)?; if start_buffer != end_buffer { return None; }