From b9cdb851d2f448f72bf57b322daf1b0797141a30 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:31:24 +0200 Subject: [PATCH] Update results text --- crates/search/src/project_search.rs | 31 +++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 9b6b8da320..1321aadb4f 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -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::::new(0, cx, |_, _| { - Label::new(text, theme.search.results_status.clone()) - .aligned() + 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, cx: &mut ViewContext, ) -> Task> { - 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) { - 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(