debugger: Fix typing in active buffer resulting a jump to an active debug line (#27439)

/cc @iamnbutler 

Release Notes:

- N/A

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
This commit is contained in:
Piotr Osiewicz 2025-03-25 18:08:36 +01:00 committed by GitHub
parent f9212a001e
commit 2fe2028e20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 42 additions and 30 deletions

View file

@ -3,7 +3,7 @@ use std::time::Duration;
use std::{ops::Range, path::PathBuf};
use anyhow::Result;
use editor::scroll::{Autoscroll, AutoscrollStrategy};
use editor::scroll::Autoscroll;
use editor::{Editor, EditorEvent};
use gpui::{
list, App, ClickEvent, Context, Entity, EventEmitter, FocusHandle, Focusable,
@ -408,12 +408,9 @@ impl MarkdownPreviewView {
) {
if let Some(state) = &self.active_editor {
state.editor.update(cx, |editor, cx| {
editor.change_selections(
Some(Autoscroll::Strategy(AutoscrollStrategy::Center)),
window,
cx,
|selections| selections.select_ranges(vec![selection]),
);
editor.change_selections(Some(Autoscroll::center()), window, cx, |selections| {
selections.select_ranges(vec![selection])
});
window.focus(&editor.focus_handle(cx));
});
}