pane: Fix tooltips of navigation buttons (#17035)

Tooltips for "Go Forward"/"Go Back" did not show the keybindings. Now
they do.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz
2024-08-29 00:28:00 +02:00
committed by GitHub
parent 9ca772991f
commit dfd113dfb0
3 changed files with 24 additions and 9 deletions
+14 -1
View File
@@ -1,4 +1,4 @@
use gpui::{Action, AnyView, IntoElement, Render, VisualContext};
use gpui::{Action, AnyView, FocusHandle, IntoElement, Render, VisualContext};
use settings::Settings;
use theme::ThemeSettings;
@@ -34,6 +34,19 @@ impl Tooltip {
.into()
}
pub fn for_action_in(
title: impl Into<SharedString>,
action: &dyn Action,
focus_handle: &FocusHandle,
cx: &mut WindowContext,
) -> AnyView {
cx.new_view(|cx| Self {
title: title.into(),
meta: None,
key_binding: KeyBinding::for_action_in(action, focus_handle, cx),
})
.into()
}
pub fn with_meta(
title: impl Into<SharedString>,
action: Option<&dyn Action>,