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.

repl: Fix repl-over-selection not being Vim-line-wise aware (#15068)

Thorsten Ballba6c36f3704d
diff --git a/crates/repl/src/repl_editor.rs b/crates/repl/src/repl_editor.rs
index 90838bf10aa..e0c64cef01e 100644
--- a/crates/repl/src/repl_editor.rs
+++ b/crates/repl/src/repl_editor.rs
@@ -138,12 +138,14 @@ fn snippet(
editor: WeakView<Editor>,
cx: &mut WindowContext,
) -> Option<(String, Arc<Language>, Range<Anchor>)> {
+ let selection = editor
+ .update(cx, |editor, cx| editor.selections.newest_adjusted(cx))
+ .ok()?;
+
let editor = editor.upgrade()?;
let editor = editor.read(cx);
let buffer = editor.buffer().read(cx).snapshot(cx);
-
- let selection = editor.selections.newest::<Point>(cx);
let multi_buffer_snapshot = editor.buffer().read(cx).snapshot(cx);
let range = if selection.is_empty() {