Git panel: Fix commit binding tooltip not showing up (#25472)

Co-authored by: Conrad <conrad@zed.dev>

Release Notes:

- N/A
This commit is contained in:
João Marcos 2025-02-24 13:41:37 -03:00 committed by GitHub
parent 198c36811e
commit dd0de3cfa9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 7 deletions

View file

@ -191,6 +191,7 @@ impl CommitModal {
window.dispatch_action(zed_actions::git::Branch.boxed_clone(), cx);
}))
.style(ButtonStyle::Transparent);
h_flex()
.w_full()
.justify_between()

View file

@ -1682,9 +1682,6 @@ impl GitPanel {
let panel_editor_style = panel_editor_style(true, window, cx);
let enable_coauthors = self.render_co_authors(cx);
let editor_focus_handle = editor.read(cx).focus_handle(cx).clone();
let focus_handle_1 = self.focus_handle(cx).clone();
let tooltip = if self.has_staged_changes() {
"Commit staged changes"
} else {
@ -1695,11 +1692,11 @@ impl GitPanel {
} else {
"Commit All"
};
let editor_focus_handle = self.commit_editor.focus_handle(cx);
let commit_button = panel_filled_button(title)
.tooltip(move |window, cx| {
let focus_handle = focus_handle_1.clone();
Tooltip::for_action_in(tooltip, &Commit, &focus_handle, window, cx)
Tooltip::for_action_in(tooltip, &Commit, &editor_focus_handle, window, cx)
})
.disabled(!can_commit)
.on_click({
@ -1743,8 +1740,8 @@ impl GitPanel {
.border_color(cx.theme().colors().border)
.bg(cx.theme().colors().editor_background)
.cursor_text()
.on_click(cx.listener(move |_, _: &ClickEvent, window, _cx| {
window.focus(&editor_focus_handle);
.on_click(cx.listener(move |this, _: &ClickEvent, window, cx| {
window.focus(&this.commit_editor.focus_handle(cx));
}))
.when(!self.modal_open, |el| {
el.child(EditorElement::new(&self.commit_editor, panel_editor_style))