mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-10 20:41:59 +00:00
Add headers and footers to file finder
This commit is contained in:
parent
a9b5c1d867
commit
55f06dcdb5
1 changed files with 8 additions and 0 deletions
|
@ -45,6 +45,12 @@ pub trait PickerDelegate: Sized + 'static {
|
||||||
fn center_selection_after_match_updates(&self) -> bool {
|
fn center_selection_after_match_updates(&self) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
fn render_header(&self, cx: &AppContext) -> Option<AnyElement<Picker<Self>>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
fn render_footer(&self, cx: &AppContext) -> Option<AnyElement<Picker<Self>>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<D: PickerDelegate> Entity for Picker<D> {
|
impl<D: PickerDelegate> Entity for Picker<D> {
|
||||||
|
@ -77,6 +83,7 @@ impl<D: PickerDelegate> View for Picker<D> {
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(editor_style),
|
.with_style(editor_style),
|
||||||
)
|
)
|
||||||
|
.with_children(self.delegate.render_header(cx))
|
||||||
.with_children(if match_count == 0 {
|
.with_children(if match_count == 0 {
|
||||||
if query.is_empty() {
|
if query.is_empty() {
|
||||||
None
|
None
|
||||||
|
@ -118,6 +125,7 @@ impl<D: PickerDelegate> View for Picker<D> {
|
||||||
.into_any(),
|
.into_any(),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
.with_children(self.delegate.render_footer(cx))
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(container_style)
|
.with_style(container_style)
|
||||||
.constrained()
|
.constrained()
|
||||||
|
|
Loading…
Reference in a new issue