Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix code action selection bug while using vim visual mode (#27817)

Austin Merrickdad33f7cc2f5
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 51435aefe39..cd55b55441b 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<Self>) -> 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;
}