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.

git_ui: Allow splitting `commit_view` pane (#39025)

Lukas Wirth6f5d1522cb7b
diff --git a/crates/git_ui/src/commit_view.rs b/crates/git_ui/src/commit_view.rs
index ac00955b611..4d6be7c5928 100644
--- a/crates/git_ui/src/commit_view.rs
+++ b/crates/git_ui/src/commit_view.rs
@@ -522,6 +522,29 @@ impl Item for CommitView {
editor.added_to_workspace(workspace, window, cx)
});
}
+
+ fn clone_on_split(
+ &self,
+ _workspace_id: Option<workspace::WorkspaceId>,
+ window: &mut Window,
+ cx: &mut Context<Self>,
+ ) -> Option<Entity<Self>>
+ where
+ Self: Sized,
+ {
+ Some(cx.new(|cx| {
+ let editor = cx.new(|cx| {
+ self.editor
+ .update(cx, |editor, cx| editor.clone(window, cx))
+ });
+ let multibuffer = editor.read(cx).buffer().clone();
+ Self {
+ editor,
+ multibuffer,
+ commit: self.commit.clone(),
+ }
+ }))
+ }
}
impl Render for CommitView {