From ba6c36f3704deb86d09c255d9714c4236c716923 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Wed, 24 Jul 2024 10:06:38 +0200 Subject: [PATCH] repl: Fix repl-over-selection not being Vim-line-wise aware (#15068) Release Notes: - N/A --- crates/repl/src/repl_editor.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/repl/src/repl_editor.rs b/crates/repl/src/repl_editor.rs index 90838bf10aaef34c25f6db2e33cb0bfc6410650c..e0c64cef01e4598bf9c46cd9fb078aab8ae98b66 100644 --- a/crates/repl/src/repl_editor.rs +++ b/crates/repl/src/repl_editor.rs @@ -138,12 +138,14 @@ fn snippet( editor: WeakView, cx: &mut WindowContext, ) -> Option<(String, Arc, Range)> { + 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::(cx); let multi_buffer_snapshot = editor.buffer().read(cx).snapshot(cx); let range = if selection.is_empty() {