From 7699c0e6ff2200f434dbe63a10bb6941ea61c6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Wi=C4=99cek?= Date: Thu, 4 Apr 2024 14:28:57 +0200 Subject: [PATCH] working --- ui/components/views-tabs/viewstabs.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ui/components/views-tabs/viewstabs.go b/ui/components/views-tabs/viewstabs.go index 48d8a38..d5b1426 100644 --- a/ui/components/views-tabs/viewstabs.go +++ b/ui/components/views-tabs/viewstabs.go @@ -121,7 +121,10 @@ func (m Model) View() string { BorderRight(m.ifBorders). BorderTop(m.ifBorders). BorderLeft(m.ifBorders). - // MaxWidth(m.size.Width). + // Height(1). + // Height(1 + borderMaring). + MaxHeight(1 + borderMaring). + MaxWidth(m.size.Width). Width(m.size.Width - borderMaring) s := strings.Builder{} @@ -143,16 +146,19 @@ func (m Model) View() string { } else { t = inactiveTabStyle.Render(tabContent) } - s.WriteString(" " + t + " ") - if i != len(m.tabs)-1 { - s.WriteString("|") - } + content := " " + t + " " - if s.Len()+len(moreTabsIcon) > m.ctx.WindowSize.Width { + if lipgloss.Width(s.String()+content+moreTabsIcon) >= m.size.Width-borderMaring { s.WriteString(moreTabsIcon) break } + s.WriteString(content) + + if i != len(m.tabs)-1 { + s.WriteString("|") + } + } return style.Render(s.String())