Skip to content

Commit

Permalink
search: Fix keybindings display on project search landing page (zed-i…
Browse files Browse the repository at this point in the history
…ndustries#17430)

Closes zed-industries#17429 

Release Notes:

- N/A

Co-authored-by: Danilo <[email protected]>
  • Loading branch information
osiewicz and danilo-leal authored Sep 5, 2024
1 parent fef181a commit 1b735b0
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions crates/search/src/project_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,7 @@ impl ProjectSearchView {
}

fn landing_text_minor(&self, cx: &mut ViewContext<Self>) -> impl IntoElement {
let focus_handle = self.focus_handle.clone();
v_flex()
.gap_1()
.child(Label::new("Hit enter to search. For more options:"))
Expand All @@ -1199,39 +1200,47 @@ impl ProjectSearchView {
.icon(IconName::Filter)
.icon_position(IconPosition::Start)
.icon_size(IconSize::Small)
.key_binding(KeyBinding::for_action(&ToggleFilters, cx))
.key_binding(KeyBinding::for_action_in(&ToggleFilters, &focus_handle, cx))
.on_click(|_event, cx| cx.dispatch_action(ToggleFilters.boxed_clone())),
)
.child(
Button::new("find-replace", "Find and replace")
.icon(IconName::Replace)
.icon_position(IconPosition::Start)
.icon_size(IconSize::Small)
.key_binding(KeyBinding::for_action(&ToggleReplace, cx))
.key_binding(KeyBinding::for_action_in(&ToggleReplace, &focus_handle, cx))
.on_click(|_event, cx| cx.dispatch_action(ToggleReplace.boxed_clone())),
)
.child(
Button::new("regex", "Match with regex")
.icon(IconName::Regex)
.icon_position(IconPosition::Start)
.icon_size(IconSize::Small)
.key_binding(KeyBinding::for_action(&ToggleRegex, cx))
.key_binding(KeyBinding::for_action_in(&ToggleRegex, &focus_handle, cx))
.on_click(|_event, cx| cx.dispatch_action(ToggleRegex.boxed_clone())),
)
.child(
Button::new("match-case", "Match case")
.icon(IconName::CaseSensitive)
.icon_position(IconPosition::Start)
.icon_size(IconSize::Small)
.key_binding(KeyBinding::for_action(&ToggleCaseSensitive, cx))
.key_binding(KeyBinding::for_action_in(
&ToggleCaseSensitive,
&focus_handle,
cx,
))
.on_click(|_event, cx| cx.dispatch_action(ToggleCaseSensitive.boxed_clone())),
)
.child(
Button::new("match-whole-words", "Match whole words")
.icon(IconName::WholeWord)
.icon_position(IconPosition::Start)
.icon_size(IconSize::Small)
.key_binding(KeyBinding::for_action(&ToggleWholeWord, cx))
.key_binding(KeyBinding::for_action_in(
&ToggleWholeWord,
&focus_handle,
cx,
))
.on_click(|_event, cx| cx.dispatch_action(ToggleWholeWord.boxed_clone())),
)
}
Expand Down

0 comments on commit 1b735b0

Please sign in to comment.