mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-10 12:19:28 +00:00
Z-1074/search default label (#2547)
This commit adds a default "Project search" tooltip for empty search panes. Fixes Linear ticket Z-1074 Release Notes: - Added default tooltip to empty search panes. ([#1533](https://github.com/zed-industries/community/issues/1533)).
This commit is contained in:
commit
571d2f4966
1 changed files with 8 additions and 2 deletions
|
@ -25,7 +25,7 @@ use std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
collections::HashSet,
|
collections::HashSet,
|
||||||
mem,
|
mem,
|
||||||
ops::Range,
|
ops::{Not, Range},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
|
@ -242,7 +242,13 @@ impl View for ProjectSearchView {
|
||||||
|
|
||||||
impl Item for ProjectSearchView {
|
impl Item for ProjectSearchView {
|
||||||
fn tab_tooltip_text(&self, cx: &AppContext) -> Option<Cow<str>> {
|
fn tab_tooltip_text(&self, cx: &AppContext) -> Option<Cow<str>> {
|
||||||
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>(
|
fn act_as_type<'a>(
|
||||||
|
|
Loading…
Reference in a new issue