This commit is contained in:
parent
e768eb0a34
commit
3e68f7fde4
10 changed files with 49 additions and 111 deletions
|
@ -177,34 +177,14 @@ fn commit_message_buffer(
|
|||
)
|
||||
.await
|
||||
.with_context(|| format!("creating commit message file {commit_message_file:?}"))?;
|
||||
let (worktree, relative_path) = project
|
||||
let buffer = project
|
||||
.update(&mut cx, |project, cx| {
|
||||
project.worktree_store().update(cx, |worktree_store, cx| {
|
||||
worktree_store.find_or_create_worktree(&commit_message_file, false, cx)
|
||||
})
|
||||
project.open_local_buffer(&commit_message_file, cx)
|
||||
})?
|
||||
.await
|
||||
.with_context(|| {
|
||||
format!("deriving worktree for commit message file {commit_message_file:?}")
|
||||
format!("opening commit message buffer at {commit_message_file:?}",)
|
||||
})?;
|
||||
|
||||
let buffer = project
|
||||
.update(&mut cx, |project, cx| {
|
||||
project.buffer_store().update(cx, |buffer_store, cx| {
|
||||
buffer_store.open_buffer(
|
||||
ProjectPath {
|
||||
worktree_id: worktree.read(cx).id(),
|
||||
path: Arc::from(relative_path),
|
||||
},
|
||||
true,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
})
|
||||
.with_context(|| {
|
||||
format!("opening buffer for commit message file {commit_message_file:?}")
|
||||
})?
|
||||
.await?;
|
||||
Ok(buffer)
|
||||
})
|
||||
}
|
||||
|
@ -278,6 +258,7 @@ impl GitPanel {
|
|||
pub fn new(
|
||||
workspace: &mut Workspace,
|
||||
window: &mut Window,
|
||||
commit_message_buffer: Option<Entity<Buffer>>,
|
||||
cx: &mut Context<Workspace>,
|
||||
) -> Entity<Self> {
|
||||
let fs = workspace.app_state().fs.clone();
|
||||
|
@ -294,7 +275,12 @@ impl GitPanel {
|
|||
})
|
||||
.detach();
|
||||
|
||||
let commit_editor = cx.new(|cx| commit_message_editor(None, window, cx));
|
||||
let commit_editor =
|
||||
cx.new(|cx| commit_message_editor(commit_message_buffer, window, cx));
|
||||
commit_editor.update(cx, |editor, cx| {
|
||||
editor.clear(window, cx);
|
||||
});
|
||||
|
||||
let scroll_handle = UniformListScrollHandle::new();
|
||||
|
||||
cx.subscribe_in(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue