mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-29 04:20:46 +00:00
Focus results editor only when starting a new project search
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
parent
37c052f53d
commit
76c066baee
1 changed files with 3 additions and 3 deletions
|
@ -571,9 +571,9 @@ impl ProjectSearchView {
|
||||||
self.active_match_index = None;
|
self.active_match_index = None;
|
||||||
} else {
|
} else {
|
||||||
let prev_search_id = mem::replace(&mut self.search_id, self.model.read(cx).search_id);
|
let prev_search_id = mem::replace(&mut self.search_id, self.model.read(cx).search_id);
|
||||||
let reset_selections = self.search_id != prev_search_id;
|
let is_new_search = self.search_id != prev_search_id;
|
||||||
self.results_editor.update(cx, |editor, cx| {
|
self.results_editor.update(cx, |editor, cx| {
|
||||||
if reset_selections {
|
if is_new_search {
|
||||||
editor.change_selections(Some(Autoscroll::fit()), cx, |s| {
|
editor.change_selections(Some(Autoscroll::fit()), cx, |s| {
|
||||||
s.select_ranges(match_ranges.first().cloned())
|
s.select_ranges(match_ranges.first().cloned())
|
||||||
});
|
});
|
||||||
|
@ -584,7 +584,7 @@ impl ProjectSearchView {
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
if self.query_editor.is_focused(cx) {
|
if is_new_search && self.query_editor.is_focused(cx) {
|
||||||
self.focus_results_editor(cx);
|
self.focus_results_editor(cx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue