Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
git: Fix cmd-enter (#25628)
Conrad Irwin7f214ed25a67
diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.jsonindex 849bb98c91d..fc58fb1cd95 100644--- a/assets/keymaps/default-linux.json+++ b/assets/keymaps/default-linux.json@@ -733,6 +733,12 @@"ctrl-enter": "git::Commit"}},+ {+ "context": "GitDiff > Editor",+ "bindings": {+ "ctrl-enter": "git::Commit"+ }+ },{"context": "GitPanel > Editor","bindings": {diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.jsonindex 498d9c8e418..fe0667f740e 100644--- a/assets/keymaps/default-macos.json+++ b/assets/keymaps/default-macos.json@@ -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"}},{diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rsindex 61a90998b39..8f83f793bb7 100644--- a/crates/git_ui/src/git_panel.rs+++ b/crates/git_ui/src/git_panel.rs@@ -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>) {diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rsindex 31a82ba4722..e9cb953651c 100644--- a/crates/git_ui/src/project_diff.rs+++ b/crates/git_ui/src/project_diff.rs@@ -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);})),),