Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Merge remote-tracking branch 'origin/callback-handles' into search2
Piotr Osiewicz54a3b569357e
diff --cc crates/workspace2/src/pane.rsindex 5320406dd23,28b8575fb76..1c558daa31b--- a/crates/workspace2/src/pane.rs+++ b/crates/workspace2/src/pane.rs@@@ -1922,12 -1932,16 +1932,14 @@@ impl Render for Pane// cx.add_async_action(Pane::close_items_to_the_right);// cx.add_async_action(Pane::close_all_items);.size_full()- .on_action(|pane: &mut Self, action: &CloseActiveItem, cx| {- pane.close_active_item(action, cx)- .map(|task| task.detach_and_log_err(cx));- })+ .on_action(+ cx.listener(|pane: &mut Self, action: &CloseActiveItem, cx| {+ pane.close_active_item(action, cx)+ .map(|task| task.detach_and_log_err(cx));+ }),+ ).child(self.render_tab_bar(cx))- // .child(- // div()- // ) /* todo!(toolbar) */+ .child(self.toolbar.clone()).child(if let Some(item) = self.active_item() {div().flex().flex_1().child(item.to_any())} else {diff --cc crates/workspace2/src/toolbar.rsindex 8a231b75335,8e21b3010a1..82d5deaea1f--- a/crates/workspace2/src/toolbar.rs+++ b/crates/workspace2/src/toolbar.rs@@@ -54,56 -51,11 +54,57 @@@ pub struct Toolbaritems: Vec<(Box<dyn ToolbarItemViewHandle>, ToolbarItemLocation)>,}+impl Toolbar {+ fn left_items(&self) -> impl Iterator<Item = &dyn ToolbarItemViewHandle> {+ self.items.iter().filter_map(|(item, location)| {+ if *location == ToolbarItemLocation::PrimaryLeft {+ Some(item.as_ref())+ } else {+ None+ }+ })+ }++ fn right_items(&self) -> impl Iterator<Item = &dyn ToolbarItemViewHandle> {+ self.items.iter().filter_map(|(item, location)| {+ if *location == ToolbarItemLocation::PrimaryRight {+ Some(item.as_ref())+ } else {+ None+ }+ })+ }+}+- impl Render<Self> for Toolbar {- type Element = Div<Self>;+ impl Render for Toolbar {+ type Element = Div;++fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {- todo!()+ //dbg!(&self.items.len());+ v_stack()+ .border_b()+ .border_color(cx.theme().colors().border)+ .child(+ h_stack()+ .justify_between()+ .child(+ // Toolbar left side+ h_stack()+ .p_1()+ .child(Button::new("crates"))+ .child(Label::new("/").color(TextColor::Muted))+ .child(Button::new("workspace2")),+ )+ // Toolbar right side+ .child(+ h_stack()+ .p_1()+ .child(IconButton::new("buffer-search", Icon::MagnifyingGlass))+ .child(IconButton::new("inline-assist", Icon::MagicWand)),+ ),+ )+ .children(self.items.iter().map(|(child, _)| child.to_any()))}}diff --cc crates/zed2/Cargo.tomlindex a9cab00cdeb,e7fa3a7e34c..24648f87f1d--- a/crates/zed2/Cargo.toml+++ b/crates/zed2/Cargo.toml@@@ -36,10 -36,9 +36,9 @@@ db = { package = "db2", path = "../db2editor = { package="editor2", path = "../editor2" }# feedback = { path = "../feedback" }file_finder = { package="file_finder2", path = "../file_finder2" }-# search = { path = "../search" }+search = { package = "search2", path = "../search2" }fs = { package = "fs2", path = "../fs2" }fsevent = { path = "../fsevent" }- fuzzy = { path = "../fuzzy" }go_to_line = { package = "go_to_line2", path = "../go_to_line2" }gpui = { package = "gpui2", path = "../gpui2" }install_cli = { package = "install_cli2", path = "../install_cli2" }