tab: Keep last empty when suffix exist. (#692)

This commit is contained in:
Jason Lee 2025-03-06 19:38:45 +08:00 committed by GitHub
parent c9c6449d24
commit 3a4f442945
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View file

@ -188,8 +188,8 @@ impl TabVariant {
..Default::default()
},
TabVariant::Pill => TabStyle {
fg: cx.theme().accent_foreground,
bg: cx.theme().accent,
fg: cx.theme().secondary_foreground,
bg: cx.theme().secondary_hover,
borders: Edges::all(px(1.)),
border_color: cx.theme().border,
radius: px(99.),
@ -210,7 +210,7 @@ impl TabVariant {
fg: cx.theme().tab_foreground,
bg: cx.theme().transparent,
radius: px(0.),
inner_bg: cx.theme().accent,
inner_bg: cx.theme().secondary,
inner_radius: cx.theme().radius,
borders: Edges {
bottom: px(2.),

View file

@ -224,9 +224,12 @@ impl RenderOnce for TabBar {
})
}),
)
.when(self.variant == TabVariant::Tab, |this| {
this.child(self.last_empty_space)
}),
.when(
self.suffix.is_some() && self.variant == TabVariant::Tab
|| self.variant == TabVariant::Underline
|| self.variant == TabVariant::Pill,
|this| this.child(self.last_empty_space),
),
)
.when_some(self.suffix, |this, suffix| this.child(suffix))
}