Bind actions on the whole search bar, not just the query editor
This commit is contained in:
parent
0be58eb61a
commit
fe315c6111
1 changed files with 32 additions and 32 deletions
|
@ -1732,42 +1732,10 @@ impl Render for ProjectSearchBar {
|
|||
h_stack()
|
||||
.min_w_80()
|
||||
.on_action(cx.listener(|this, action, cx| this.confirm(action, cx)))
|
||||
.on_action(cx.listener(|this, _: &ToggleFilters, cx| {
|
||||
this.toggle_filters(cx);
|
||||
}))
|
||||
.on_action(cx.listener(|this, _: &ToggleWholeWord, cx| {
|
||||
this.toggle_search_option(SearchOptions::WHOLE_WORD, cx);
|
||||
}))
|
||||
.on_action(cx.listener(|this, _: &ToggleCaseSensitive, cx| {
|
||||
this.toggle_search_option(SearchOptions::CASE_SENSITIVE, cx);
|
||||
}))
|
||||
.on_action(cx.listener(|this, action, cx| {
|
||||
this.toggle_replace(action, cx);
|
||||
}))
|
||||
.on_action(cx.listener(|this, _: &ActivateTextMode, cx| {
|
||||
this.activate_search_mode(SearchMode::Text, cx)
|
||||
}))
|
||||
.on_action(cx.listener(|this, _: &ActivateRegexMode, cx| {
|
||||
this.activate_search_mode(SearchMode::Regex, cx)
|
||||
}))
|
||||
.on_action(
|
||||
cx.listener(|this, action, cx| this.previous_history_query(action, cx)),
|
||||
)
|
||||
.on_action(cx.listener(|this, action, cx| this.next_history_query(action, cx)))
|
||||
.on_action(cx.listener(|this, action, cx| {
|
||||
if let Some(search) = this.active_project_search.as_ref() {
|
||||
search.update(cx, |this, cx| {
|
||||
this.replace_next(action, cx);
|
||||
})
|
||||
}
|
||||
}))
|
||||
.on_action(cx.listener(|this, action, cx| {
|
||||
if let Some(search) = this.active_project_search.as_ref() {
|
||||
search.update(cx, |this, cx| {
|
||||
this.replace_all(action, cx);
|
||||
})
|
||||
}
|
||||
}))
|
||||
.child(IconElement::new(Icon::MagnifyingGlass))
|
||||
.child(search.query_editor.clone())
|
||||
.child(
|
||||
|
@ -1937,6 +1905,38 @@ impl Render for ProjectSearchBar {
|
|||
.p_1()
|
||||
.m_2()
|
||||
.justify_between()
|
||||
.on_action(cx.listener(|this, _: &ToggleFilters, cx| {
|
||||
this.toggle_filters(cx);
|
||||
}))
|
||||
.on_action(cx.listener(|this, _: &ToggleWholeWord, cx| {
|
||||
this.toggle_search_option(SearchOptions::WHOLE_WORD, cx);
|
||||
}))
|
||||
.on_action(cx.listener(|this, _: &ToggleCaseSensitive, cx| {
|
||||
this.toggle_search_option(SearchOptions::CASE_SENSITIVE, cx);
|
||||
}))
|
||||
.on_action(cx.listener(|this, action, cx| {
|
||||
this.toggle_replace(action, cx);
|
||||
}))
|
||||
.on_action(cx.listener(|this, _: &ActivateTextMode, cx| {
|
||||
this.activate_search_mode(SearchMode::Text, cx)
|
||||
}))
|
||||
.on_action(cx.listener(|this, _: &ActivateRegexMode, cx| {
|
||||
this.activate_search_mode(SearchMode::Regex, cx)
|
||||
}))
|
||||
.on_action(cx.listener(|this, action, cx| {
|
||||
if let Some(search) = this.active_project_search.as_ref() {
|
||||
search.update(cx, |this, cx| {
|
||||
this.replace_next(action, cx);
|
||||
})
|
||||
}
|
||||
}))
|
||||
.on_action(cx.listener(|this, action, cx| {
|
||||
if let Some(search) = this.active_project_search.as_ref() {
|
||||
search.update(cx, |this, cx| {
|
||||
this.replace_all(action, cx);
|
||||
})
|
||||
}
|
||||
}))
|
||||
.child(query_column)
|
||||
.child(mode_column)
|
||||
.child(replace_column)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue