project_search: use search history's current entry as a tab name.
Piotr Osiewicz
and
Kyle
created
Previously the tab name for Semantic Search was not updated, as we didn't have an active query to go off of
Co-authored-by: Kyle <kyle@zed.dev>
Change summary
crates/search/src/project_search.rs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
Detailed changes
@@ -499,10 +499,14 @@ impl Item for ProjectSearchView {
.with_margin_right(tab_theme.spacing),
)
.with_child({
- let tab_name: Option<Cow<_>> =
- self.model.read(cx).active_query.as_ref().map(|query| {
- let query_text =
- util::truncate_and_trailoff(query.as_str(), MAX_TAB_TITLE_LEN);
+ let tab_name: Option<Cow<_>> = self
+ .model
+ .read(cx)
+ .search_history
+ .current()
+ .as_ref()
+ .map(|query| {
+ let query_text = util::truncate_and_trailoff(query, MAX_TAB_TITLE_LEN);
query_text.into()
});
Label::new(