project search: Move to results with ESC
This commit is contained in:
parent
e81072ac0f
commit
7314838fa4
1 changed files with 18 additions and 0 deletions
|
@ -1224,6 +1224,14 @@ impl ProjectSearchView {
|
||||||
cx.theme().colors().border
|
cx.theme().colors().border
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fn move_focus_to_results(&mut self, cx: &mut ViewContext<Self>) {
|
||||||
|
if !self.results_editor.focus_handle(cx).is_focused(cx)
|
||||||
|
&& !self.model.read(cx).match_ranges.is_empty()
|
||||||
|
{
|
||||||
|
cx.stop_propagation();
|
||||||
|
return self.focus_results_editor(cx);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ProjectSearchBar {
|
impl Default for ProjectSearchBar {
|
||||||
|
@ -1398,6 +1406,15 @@ impl ProjectSearchBar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn move_focus_to_results(&self, cx: &mut ViewContext<Self>) {
|
||||||
|
if let Some(search_view) = self.active_project_search.as_ref() {
|
||||||
|
search_view.update(cx, |search_view, cx| {
|
||||||
|
search_view.move_focus_to_results(cx);
|
||||||
|
});
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn activate_search_mode(&self, mode: SearchMode, cx: &mut ViewContext<Self>) {
|
fn activate_search_mode(&self, mode: SearchMode, cx: &mut ViewContext<Self>) {
|
||||||
// Update Current Mode
|
// Update Current Mode
|
||||||
if let Some(search_view) = self.active_project_search.as_ref() {
|
if let Some(search_view) = self.active_project_search.as_ref() {
|
||||||
|
@ -1754,6 +1771,7 @@ impl Render for ProjectSearchBar {
|
||||||
.key_context(key_context)
|
.key_context(key_context)
|
||||||
.flex_grow()
|
.flex_grow()
|
||||||
.gap_2()
|
.gap_2()
|
||||||
|
.on_action(cx.listener(|this, _: &ToggleFocus, cx| this.move_focus_to_results(cx)))
|
||||||
.on_action(cx.listener(|this, _: &ToggleFilters, cx| {
|
.on_action(cx.listener(|this, _: &ToggleFilters, cx| {
|
||||||
this.toggle_filters(cx);
|
this.toggle_filters(cx);
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue