mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
project search: Move to results with ESC
This commit is contained in:
parent
e81072ac0f
commit
7314838fa4
@ -1224,6 +1224,14 @@ impl ProjectSearchView {
|
||||
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 {
|
||||
@ -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>) {
|
||||
// Update Current Mode
|
||||
if let Some(search_view) = self.active_project_search.as_ref() {
|
||||
@ -1754,6 +1771,7 @@ impl Render for ProjectSearchBar {
|
||||
.key_context(key_context)
|
||||
.flex_grow()
|
||||
.gap_2()
|
||||
.on_action(cx.listener(|this, _: &ToggleFocus, cx| this.move_focus_to_results(cx)))
|
||||
.on_action(cx.listener(|this, _: &ToggleFilters, cx| {
|
||||
this.toggle_filters(cx);
|
||||
}))
|
||||
|
Loading…
Reference in New Issue
Block a user