From 920ea1bf0a64a679dfebe4cdc611a1b8cb3c008a Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Fri, 3 Nov 2023 09:20:13 -0600 Subject: [PATCH] Make the close button close --- crates/workspace2/src/pane.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/workspace2/src/pane.rs b/crates/workspace2/src/pane.rs index 1bccaaea6410f46ae1f77a24a4c951ac1abfdc30..4c4f26fe0eeb4a8eb53af571cbf2c146edefd2c5 100644 --- a/crates/workspace2/src/pane.rs +++ b/crates/workspace2/src/pane.rs @@ -1359,7 +1359,16 @@ impl Pane { cx: &mut ViewContext<'_, Pane>, ) -> impl Component { let label = item.tab_content(Some(detail), cx); - let close_icon = || IconElement::new(Icon::Close).color(IconColor::Muted); + let close_icon = || { + let id = item.id(); + div() + .id(item.id()) + .child(IconElement::new(Icon::Close).color(IconColor::Muted)) + .on_click(move |pane: &mut Self, _, cx| { + pane.close_item_by_id(id, SaveIntent::Close, cx) + .detach_and_log_err(cx); + }) + }; let (text_color, tab_bg, tab_hover_bg, tab_active_bg) = match ix == self.active_item_index { false => (