Update results text

This commit is contained in:
Piotr Osiewicz 2023-07-27 16:31:24 +02:00
parent dff9bf7d7e
commit b9cdb851d2

View file

@ -278,17 +278,23 @@ impl View for ProjectSearchView {
Cow::Borrowed("Indexing complete")
}
} else if self.query_editor.read(cx).text(cx).is_empty() {
Cow::Borrowed("")
Cow::Borrowed("Text search all files and folders")
} else {
Cow::Borrowed("No results")
};
MouseEventHandler::<Status, _>::new(0, cx, |_, _| {
Flex::column()
.with_child(Flex::column().contained().flex(1., true))
.with_child(
Label::new(text, theme.search.results_status.clone())
.aligned()
.top()
.contained()
.flex(7., true),
)
.contained()
.with_background_color(theme.editor.background)
.flex(1., true)
})
.on_down(MouseButton::Left, |_, _, cx| {
cx.focus_parent();
@ -427,7 +433,6 @@ impl Item for ProjectSearchView {
project: ModelHandle<Project>,
cx: &mut ViewContext<Self>,
) -> Task<anyhow::Result<()>> {
self.results_editor
.update(cx, |editor, cx| editor.reload(project, cx))
}
@ -828,7 +833,6 @@ impl ProjectSearchView {
}
fn model_changed(&mut self, cx: &mut ViewContext<Self>) {
let match_ranges = self.model.read(cx).match_ranges.clone();
if match_ranges.is_empty() {
self.active_match_index = None;
@ -1030,8 +1034,12 @@ impl ProjectSearchBar {
if let Some(search_view) = self.active_project_search.as_ref() {
search_view.update(cx, |search_view, cx| {
search_view.filters_enabled = !search_view.filters_enabled;
search_view.included_files_editor.update(cx, |_, cx| {cx.notify()});
search_view.excluded_files_editor.update(cx, |_, cx| {cx.notify()});
search_view
.included_files_editor
.update(cx, |_, cx| cx.notify());
search_view
.excluded_files_editor
.update(cx, |_, cx| cx.notify());
search_view.semantic = None;
search_view.search(cx);
cx.notify();
@ -1332,8 +1340,11 @@ impl View for ProjectSearchBar {
let semantic_index =
SemanticIndex::enabled(cx).then(|| self.render_semantic_search_button(cx));
Flex::row()
.with_child(Flex::column().with_child(Flex::row().with_children(matches).aligned()
.left()).flex(1., true))
.with_child(
Flex::column()
.with_child(Flex::row().with_children(matches).aligned().left())
.flex(1., true),
)
.with_child(
Flex::column()
.with_child(