Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Więcek committed Apr 4, 2024
1 parent 2689d64 commit 7699c0e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions ui/components/views-tabs/viewstabs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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())
Expand Down

0 comments on commit 7699c0e

Please sign in to comment.