Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Scroll project diff into view always (#26379)

Conrad Irwin73dfb10c16e0
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index 1216766bcb8..7bc67400997 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -749,6 +749,7 @@ impl GitPanel {
.as_ref()
{
project_diff.focus_handle(cx).focus(window);
+ project_diff.update(cx, |project_diff, cx| project_diff.autoscroll(cx));
return None;
}
}
diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs
index 973e78270c8..6af71ffb9d7 100644
--- a/crates/git_ui/src/project_diff.rs
+++ b/crates/git_ui/src/project_diff.rs
@@ -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(
project: Entity<Project>,
workspace: Entity<Workspace>,