From d312a13f8ab3288524b22ecd7405221d5735d3c6 Mon Sep 17 00:00:00 2001 From: Finn Evers Date: Sat, 24 May 2025 22:36:51 +0200 Subject: [PATCH] ui: Fix content shift when selecting last tab (#31266) Follow-up to #29061 This PR ensures that the last tab does not flicker when either selecting. It also fixes an issue where the layout would shift in the new last tab when closing the last tab. https://github.com/user-attachments/assets/529a2a92-f25c-4ced-a992-fb6b2d3b5f61 This happened because in #29061, the left padding was removed due to issues with borders. However, the padding is relevant for the content to not shift (we are basically doing border-box sizing manually here). Instead, we need to remove the padding on the right side, as there is already a border present on the right side and this padding would make the last tab slightly larger than all other tabs. https://github.com/user-attachments/assets/c3a10b3c-4a1d-4160-9b68-7538207bb46e Release Notes: - Removed a small flicker when selecting or closing the last tab in a pane. --- crates/ui/src/components/tab.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui/src/components/tab.rs b/crates/ui/src/components/tab.rs index 71736c46ba56114ca96d0f1dcf43772ffcf87160..a205c33358eb7ac46d81572948a3165967b734d6 100644 --- a/crates/ui/src/components/tab.rs +++ b/crates/ui/src/components/tab.rs @@ -154,7 +154,7 @@ impl RenderOnce for Tab { if self.selected { this.border_l_1().border_r_1().pb_px() } else { - this.pr_px().border_b_1().border_r_1() + this.pl_px().border_b_1().border_r_1() } } TabPosition::Middle(Ordering::Equal) => this.border_l_1().border_r_1().pb_px(),