project_search: use search history's current entry as a tab name.

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>
This commit is contained in:
Piotr Osiewicz 2023-08-21 13:30:32 +02:00
parent 61041b0cd1
commit 67a48ec106

View file

@ -499,10 +499,14 @@ impl Item for ProjectSearchView {
.with_margin_right(tab_theme.spacing), .with_margin_right(tab_theme.spacing),
) )
.with_child({ .with_child({
let tab_name: Option<Cow<_>> = let tab_name: Option<Cow<_>> = self
self.model.read(cx).active_query.as_ref().map(|query| { .model
let query_text = .read(cx)
util::truncate_and_trailoff(query.as_str(), MAX_TAB_TITLE_LEN); .search_history
.current()
.as_ref()
.map(|query| {
let query_text = util::truncate_and_trailoff(query, MAX_TAB_TITLE_LEN);
query_text.into() query_text.into()
}); });
Label::new( Label::new(