From dc5ffe6994b0f2467164a7e1dd77dada96b64980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Fri, 27 Sep 2024 16:55:03 +0200 Subject: [PATCH] Fix GoToDefinition changing the viewport unnecessarily (#18441) Closes #10738. Release Notes: - Fixed `GoToDefinition` changing the viewport (scrolling up/down) even when the definition is already within the viewport. ([#10738](https://github.com/zed-industries/zed/issues/10738)) --- crates/editor/src/editor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 44de6014ec..cfffa584b6 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -9697,7 +9697,7 @@ impl Editor { if Some(&target.buffer) == editor.buffer.read(cx).as_singleton().as_ref() { let buffer = target.buffer.read(cx); let range = check_multiline_range(buffer, range); - editor.change_selections(Some(Autoscroll::focused()), cx, |s| { + editor.change_selections(Some(Autoscroll::fit()), cx, |s| { s.select_ranges([range]); }); } else {