Don't focus query editor if there are matches on tab switch
This commit is contained in:
@@ -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>,
|
||||||
|
|||||||
Reference in New Issue
Block a user