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

Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-07-24 10:06:38 +02:00 committed by GitHub
parent 7644605f0f
commit ba6c36f370
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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() {