Show placeholder text for pickers

This commit is contained in:
Antonio Scandurra 2022-11-04 10:18:29 +01:00
parent 08b84416d2
commit 0b231e58fd
19 changed files with 76 additions and 40 deletions

View file

@ -12,7 +12,7 @@ use gpui::{
use project::search::SearchQuery;
use serde::Deserialize;
use settings::Settings;
use std::any::Any;
use std::{any::Any, sync::Arc};
use workspace::{
searchable::{Direction, SearchEvent, SearchableItemHandle, WeakSearchableItemHandle},
ItemHandle, Pane, ToolbarItemLocation, ToolbarItemView,
@ -232,7 +232,11 @@ impl ToolbarItemView for BufferSearchBar {
impl BufferSearchBar {
pub fn new(cx: &mut ViewContext<Self>) -> Self {
let query_editor = cx.add_view(|cx| {
Editor::auto_height(2, Some(|theme| theme.search.editor.input.clone()), cx)
Editor::auto_height(
2,
Some(Arc::new(|theme| theme.search.editor.input.clone())),
cx,
)
});
cx.subscribe(&query_editor, Self::on_query_editor_event)
.detach();

View file

@ -20,6 +20,7 @@ use std::{
any::{Any, TypeId},
ops::Range,
path::PathBuf,
sync::Arc,
};
use util::ResultExt as _;
use workspace::{
@ -378,8 +379,10 @@ impl ProjectSearchView {
.detach();
let query_editor = cx.add_view(|cx| {
let mut editor =
Editor::single_line(Some(|theme| theme.search.editor.input.clone()), cx);
let mut editor = Editor::single_line(
Some(Arc::new(|theme| theme.search.editor.input.clone())),
cx,
);
editor.set_text(query_text, cx);
editor
});