Scroll project diff into view always (#26379)

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2025-03-10 12:28:07 -06:00 committed by GitHub
parent e513e81046
commit 73dfb10c16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View file

@ -749,6 +749,7 @@ impl GitPanel {
.as_ref() .as_ref()
{ {
project_diff.focus_handle(cx).focus(window); project_diff.focus_handle(cx).focus(window);
project_diff.update(cx, |project_diff, cx| project_diff.autoscroll(cx));
return None; return None;
} }
} }

View file

@ -125,6 +125,12 @@ impl ProjectDiff {
} }
} }
pub fn autoscroll(&self, cx: &mut Context<Self>) {
self.editor.update(cx, |editor, cx| {
editor.request_autoscroll(Autoscroll::fit(), cx);
})
}
fn new( fn new(
project: Entity<Project>, project: Entity<Project>,
workspace: Entity<Workspace>, workspace: Entity<Workspace>,