Don't focus query editor if there are matches on tab switch

This commit is contained in:
Antonio Scandurra
2022-02-25 17:23:03 +01:00
parent b506db7c93
commit 1e04411066
+13 -1
View File
@@ -186,7 +186,11 @@ impl View for ProjectFindView {
} }
fn on_focus(&mut self, cx: &mut ViewContext<Self>) { fn on_focus(&mut self, cx: &mut ViewContext<Self>) {
cx.focus(&self.query_editor); if self.model.read(cx).highlighted_ranges.is_empty() {
cx.focus(&self.query_editor);
} else {
cx.focus(&self.results_editor);
}
} }
} }
@@ -227,6 +231,14 @@ impl ItemView for ProjectFindView {
true true
} }
fn is_dirty(&self, cx: &AppContext) -> bool {
self.results_editor.read(cx).is_dirty(cx)
}
fn has_conflict(&self, cx: &AppContext) -> bool {
self.results_editor.read(cx).has_conflict(cx)
}
fn save( fn save(
&mut self, &mut self,
project: ModelHandle<Project>, project: ModelHandle<Project>,