Add missing shortcuts in tooltips (#18282)
Fixes some missing shortcuts from Tooltips like the project search, buffer search, quick action bar, .... https://github.com/user-attachments/assets/d3a0160a-8d6e-4ddc-bf82-1fabeca42d59 This should hopefully help new users learn and discover some nice keyboard shortcuts Release Notes: - Display keyboard shortcuts inside tooltips in the project search, buffer search etc.
This commit is contained in:
parent
a1d2e1106e
commit
1c5d9c221a
9 changed files with 199 additions and 43 deletions
|
@ -1,7 +1,7 @@
|
|||
use bitflags::bitflags;
|
||||
pub use buffer_search::BufferSearchBar;
|
||||
use editor::SearchSettings;
|
||||
use gpui::{actions, Action, AppContext, IntoElement};
|
||||
use gpui::{actions, Action, AppContext, FocusHandle, IntoElement};
|
||||
use project::search::SearchQuery;
|
||||
pub use project_search::ProjectSearchView;
|
||||
use ui::{prelude::*, Tooltip};
|
||||
|
@ -106,6 +106,7 @@ impl SearchOptions {
|
|||
pub fn as_button(
|
||||
&self,
|
||||
active: bool,
|
||||
focus_handle: FocusHandle,
|
||||
action: impl Fn(&gpui::ClickEvent, &mut WindowContext) + 'static,
|
||||
) -> impl IntoElement {
|
||||
IconButton::new(self.label(), self.icon())
|
||||
|
@ -115,7 +116,7 @@ impl SearchOptions {
|
|||
.tooltip({
|
||||
let action = self.to_toggle_action();
|
||||
let label = self.label();
|
||||
move |cx| Tooltip::for_action(label, &*action, cx)
|
||||
move |cx| Tooltip::for_action_in(label, &*action, &focus_handle, cx)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue