From e1a6dc90770ad5269ad5d464606028a6dadfe160 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Thu, 1 Jun 2023 11:03:02 +0200 Subject: [PATCH 1/2] search: Add a default tooltip for empty searches Z-1074 --- crates/search/src/project_search.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 2c22517e20..0f8c9173bc 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -25,7 +25,7 @@ use std::{ borrow::Cow, collections::HashSet, mem, - ops::Range, + ops::{Not, Range}, path::PathBuf, sync::Arc, }; @@ -242,7 +242,13 @@ impl View for ProjectSearchView { impl Item for ProjectSearchView { fn tab_tooltip_text(&self, cx: &AppContext) -> Option> { - Some(self.query_editor.read(cx).text(cx).into()) + let query_text = self.query_editor.read(cx).text(cx); + + query_text + .is_empty() + .not() + .then(|| query_text.into()) + .or_else(|| Some("Project search".into())) } fn act_as_type<'a>( From 01621972c5d05c5f377487a1dcf8b39bb3977969 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Thu, 1 Jun 2023 12:31:37 +0200 Subject: [PATCH 2/2] Change "Project search" to "Project Search" --- crates/search/src/project_search.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 0f8c9173bc..27aac1762b 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -248,7 +248,7 @@ impl Item for ProjectSearchView { .is_empty() .not() .then(|| query_text.into()) - .or_else(|| Some("Project search".into())) + .or_else(|| Some("Project Search".into())) } fn act_as_type<'a>(