Git: Fix Linux bindings (#25486)

- Tooltip with binding wasn't showing up
- Missing Linux bindings
- Commit modal wasn't opening when binding was pressed

Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
João Marcos 2025-02-24 15:49:17 -03:00 committed by GitHub
parent b2921bd3fd
commit ec7ce41324
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 18 deletions

View file

@ -368,7 +368,12 @@
"ctrl-\\": "pane::SplitRight",
"ctrl-k v": "markdown::OpenPreviewToTheSide",
"ctrl-shift-v": "markdown::OpenPreview",
"ctrl-alt-shift-c": "editor::DisplayCursorNames"
"ctrl-alt-shift-c": "editor::DisplayCursorNames",
"ctrl-alt-y": "git::ToggleStaged",
"alt-y": "git::StageAndNext",
"alt-shift-y": "git::UnstageAndNext",
"alt-.": "editor::GoToHunk",
"alt-,": "editor::GoToPrevHunk"
}
},
{
@ -705,12 +710,6 @@
"space": "project_panel::Open"
}
},
{
"context": "GitPanel && !CommitEditor",
"bindings": {
"escape": "git_panel::Close"
}
},
{
"context": "GitPanel && ChangesList",
"bindings": {
@ -722,16 +721,24 @@
"ctrl-shift-space": "git::UnstageAll",
"tab": "git_panel::FocusEditor",
"shift-tab": "git_panel::FocusEditor",
"escape": "git_panel::ToggleFocus"
"escape": "git_panel::ToggleFocus",
"ctrl-enter": "git::Commit"
}
},
{
"context": "GitCommit > Editor",
"bindings": {
"enter": "editor::Newline",
"ctrl-enter": "git::Commit"
}
},
{
"context": "GitPanel > Editor",
"bindings": {
"escape": "git_panel::FocusChanges",
"ctrl-enter": "git::Commit",
"tab": "git_panel::FocusChanges",
"shift-tab": "git_panel::FocusChanges",
"ctrl-enter": "git::Commit",
"alt-up": "git_panel::FocusChanges"
}
},

View file

@ -1059,17 +1059,15 @@ impl GitPanel {
}
}
/// Commit all staged changes
fn commit(&mut self, _: &git::Commit, window: &mut Window, cx: &mut Context<Self>) {
let editor = self.commit_editor.read(cx);
if editor.is_empty(cx) {
if !editor.focus_handle(cx).contains_focused(window, cx) {
editor.focus_handle(cx).focus(window);
return;
}
if self
.commit_editor
.focus_handle(cx)
.contains_focused(window, cx)
{
self.commit_changes(window, cx)
}
self.commit_changes(window, cx)
cx.propagate();
}
pub(crate) fn commit_changes(&mut self, window: &mut Window, cx: &mut Context<Self>) {