From 836f623800fce6a69341f7b2b9f5021763491882 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Fri, 19 Jul 2024 08:04:57 -0400 Subject: [PATCH] Update icon positioning in tabs (#14804) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR updates the icon positioning in tabs to make give them even spacing on either side. Without file icons: Screenshot 2024-07-19 at 7 55 39 AM With file icons: Screenshot 2024-07-19 at 7 55 52 AM Release Notes: - N/A --- crates/workspace/src/pane.rs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 979aa2c9bd..7d267ce0c9 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1665,16 +1665,7 @@ impl Pane { .when_some(item.tab_tooltip_text(cx), |tab, text| { tab.tooltip(move |cx| Tooltip::text(text.clone(), cx)) }) - .map(|tab| match indicator { - Some(indicator) => tab.start_slot(indicator), - None => tab.start_slot::(icon.map(|icon| { - icon.size(IconSize::XSmall).color(if is_active { - Color::Default - } else { - Color::Muted - }) - })), - }) + .start_slot::(indicator) .end_slot( IconButton::new("close tab", IconName::Close) .shape(IconButtonShape::Square) @@ -1686,7 +1677,18 @@ impl Pane { .detach_and_log_err(cx); })), ) - .child(label); + .child( + h_flex() + .gap_1() + .children(icon.map(|icon| { + icon.size(IconSize::Small).color(if is_active { + Color::Default + } else { + Color::Muted + }) + })) + .child(label), + ); let single_entry_to_resolve = { let item_entries = self.items[ix].project_entry_ids(cx);