Introduced ItemEvent and to_item_events function to Item trait which converts the Item's events into a standard ItemEvent similar to how SearchableItems work.
Add breadcrumb_location and breadcrumbs functions to item trait which handles rendering of the breadcrumb elements Change breadcrumb toolbar to use these new functions rather than having hard coded breadcrumb logic Add breadcrumb support to the terminal tabs Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
parent
ab81093ef5
commit
31ecb2f7bc
8 changed files with 149 additions and 99 deletions
|
@ -189,7 +189,9 @@ impl ToolbarItemView for BufferSearchBar {
|
|||
self.active_searchable_item.take();
|
||||
self.pending_search.take();
|
||||
|
||||
if let Some(searchable_item_handle) = item.and_then(|item| item.as_searchable(cx)) {
|
||||
if let Some(searchable_item_handle) =
|
||||
item.and_then(|item| item.to_searchable_item_handle(cx))
|
||||
{
|
||||
let handle = cx.weak_handle();
|
||||
self.active_searchable_item_subscription =
|
||||
Some(searchable_item_handle.subscribe_to_search_events(
|
||||
|
|
|
@ -329,11 +329,23 @@ impl Item for ProjectSearchView {
|
|||
|
||||
fn to_item_events(event: &Self::Event) -> Vec<ItemEvent> {
|
||||
match event {
|
||||
ViewEvent::UpdateTab => vec![ItemEvent::UpdateTab],
|
||||
ViewEvent::UpdateTab => vec![ItemEvent::UpdateBreadcrumbs, ItemEvent::UpdateTab],
|
||||
ViewEvent::EditorEvent(editor_event) => Editor::to_item_events(editor_event),
|
||||
_ => Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
fn breadcrumb_location(&self) -> ToolbarItemLocation {
|
||||
if self.has_matches() {
|
||||
ToolbarItemLocation::Secondary
|
||||
} else {
|
||||
ToolbarItemLocation::Hidden
|
||||
}
|
||||
}
|
||||
|
||||
fn breadcrumbs(&self, theme: &theme::Theme, cx: &AppContext) -> Option<Vec<ElementBox>> {
|
||||
self.results_editor.breadcrumbs(theme, cx)
|
||||
}
|
||||
}
|
||||
|
||||
impl ProjectSearchView {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue