Skip to content

Commit

Permalink
Fix GoToDefinition changing the viewport unnecessarily (#18441)
Browse files Browse the repository at this point in the history
Closes #10738.

Release Notes:

- Fixed `GoToDefinition` changing the viewport (scrolling up/down) even when the definition is already within the viewport. ([#10738](#10738))
  • Loading branch information
osa1 authored Sep 27, 2024
1 parent 03c7f08 commit dc5ffe6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/editor/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit dc5ffe6

Please sign in to comment.