@@ -733,6 +733,12 @@
|
||||
"ctrl-enter": "git::Commit"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "GitDiff > Editor",
|
||||
"bindings": {
|
||||
"ctrl-enter": "git::Commit"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "GitPanel > Editor",
|
||||
"bindings": {
|
||||
|
||||
@@ -739,7 +739,15 @@
|
||||
"alt-down": "git_panel::FocusEditor",
|
||||
"tab": "git_panel::FocusEditor",
|
||||
"shift-tab": "git_panel::FocusEditor",
|
||||
"escape": "git_panel::ToggleFocus"
|
||||
"escape": "git_panel::ToggleFocus",
|
||||
"cmd-enter": "git::Commit"
|
||||
}
|
||||
},
|
||||
{
|
||||
"context": "GitDiff > Editor",
|
||||
"use_key_equivalents": true,
|
||||
"bindings": {
|
||||
"cmd-enter": "git::Commit"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -80,17 +80,6 @@ pub fn init(cx: &mut App) {
|
||||
workspace.register_action(|workspace, _: &ToggleFocus, window, cx| {
|
||||
workspace.toggle_panel_focus::<GitPanel>(window, cx);
|
||||
});
|
||||
|
||||
// workspace.register_action(|workspace, _: &Commit, window, cx| {
|
||||
// workspace.open_panel::<GitPanel>(window, cx);
|
||||
// if let Some(git_panel) = workspace.panel::<GitPanel>(cx) {
|
||||
// git_panel
|
||||
// .read(cx)
|
||||
// .commit_editor
|
||||
// .focus_handle(cx)
|
||||
// .focus(window);
|
||||
// }
|
||||
// });
|
||||
},
|
||||
)
|
||||
.detach();
|
||||
@@ -1116,8 +1105,9 @@ impl GitPanel {
|
||||
.contains_focused(window, cx)
|
||||
{
|
||||
self.commit_changes(window, cx)
|
||||
} else {
|
||||
cx.propagate();
|
||||
}
|
||||
cx.propagate();
|
||||
}
|
||||
|
||||
pub(crate) fn commit_changes(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
|
||||
@@ -627,6 +627,7 @@ impl Render for ProjectDiff {
|
||||
|
||||
div()
|
||||
.track_focus(&self.focus_handle)
|
||||
.key_context(if is_empty { "EmptyPane" } else { "GitDiff" })
|
||||
.bg(cx.theme().colors().editor_background)
|
||||
.flex()
|
||||
.items_center()
|
||||
@@ -873,11 +874,17 @@ impl Render for ProjectDiffToolbar {
|
||||
.when(
|
||||
button_states.unstage_all && !button_states.stage_all,
|
||||
|el| {
|
||||
el.child(Button::new("unstage-all", "Unstage All").on_click(
|
||||
cx.listener(|this, _, window, cx| {
|
||||
this.dispatch_panel_action(&UnstageAll, window, cx)
|
||||
}),
|
||||
))
|
||||
el.child(
|
||||
Button::new("unstage-all", "Unstage All")
|
||||
.tooltip(Tooltip::for_action_title_in(
|
||||
"Unstage all changes",
|
||||
&UnstageAll,
|
||||
&focus_handle,
|
||||
))
|
||||
.on_click(cx.listener(|this, _, window, cx| {
|
||||
this.dispatch_panel_action(&UnstageAll, window, cx)
|
||||
})),
|
||||
)
|
||||
},
|
||||
)
|
||||
.when(
|
||||
@@ -889,6 +896,11 @@ impl Render for ProjectDiffToolbar {
|
||||
div().child(
|
||||
Button::new("stage-all", "Stage All")
|
||||
.disabled(!button_states.stage_all)
|
||||
.tooltip(Tooltip::for_action_title_in(
|
||||
"Stage all changes",
|
||||
&StageAll,
|
||||
&focus_handle,
|
||||
))
|
||||
.on_click(cx.listener(|this, _, window, cx| {
|
||||
this.dispatch_panel_action(&StageAll, window, cx)
|
||||
})),
|
||||
@@ -899,8 +911,12 @@ impl Render for ProjectDiffToolbar {
|
||||
.child(
|
||||
Button::new("commit", "Commit")
|
||||
.disabled(!button_states.commit)
|
||||
.tooltip(Tooltip::for_action_title_in(
|
||||
"Commit",
|
||||
&Commit,
|
||||
&focus_handle,
|
||||
))
|
||||
.on_click(cx.listener(|this, _, window, cx| {
|
||||
// todo this should open modal, not focus panel.
|
||||
this.dispatch_action(&Commit, window, cx);
|
||||
})),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user