-
Notifications
You must be signed in to change notification settings - Fork 813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tab width top border #1068
Comments
Hi @cksc123 You can fix it by adding some vertical lines to the Here’s a fix for your case, where WIDTH is the desired value. func (m model) View() string {
doc := strings.Builder{}
var renderedTabs []string
for i, t := range m.Tabs {
var style lipgloss.Style
isFirst, isLast, isActive := i == 0, i == len(m.Tabs)-1, i == m.activeTab
if isActive {
style = activeTabStyle
} else {
style = inactiveTabStyle
}
border, _, _, _, _ := style.GetBorder()
if isFirst && isActive {
border.BottomLeft = "│"
} else if isFirst && !isActive {
border.BottomLeft = "├"
} else if isLast && isActive {
border.BottomRight = "└"
} else if isLast && !isActive {
border.BottomRight = "┴"
}
style = style.Border(border)
renderedTabs = append(renderedTabs, style.Render(t))
}
extend := WIDTH - lipgloss.Width(lipgloss.JoinHorizontal(lipgloss.Top, renderedTabs...))
if extend > 0 {
complementaryRow := lipgloss.NewStyle().Foreground(highlightColor).Render("\n\n" + strings.Repeat("─", extend-1) + "┐")
renderedTabs = append(renderedTabs, complementaryRow)
}
row := lipgloss.JoinHorizontal(lipgloss.Top, renderedTabs...)
doc.WriteString(row)
doc.WriteString("\n")
doc.WriteString(windowStyle.Width((lipgloss.Width(row) - windowStyle.GetHorizontalFrameSize())).Render(m.TabContent[m.activeTab]))
return docStyle.Render(doc.String())
} |
Shouldn't this issue be closed ?! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Following the tabs example, If a fixed width is used with less tabs
The top border is missing. How to fix this?
The text was updated successfully, but these errors were encountered: