- 
                Notifications
    
You must be signed in to change notification settings  - Fork 285
 
Description
Describe the bug
If I set a border style with .BorderStyle() (ie, without the "sides")
https://github.com/charmbracelet/lipgloss/blob/v2-exp/set.go#L449
As it says I do not specify sides as with the .Border() setter but all sides will be enabled during render which happens here:
https://github.com/charmbracelet/lipgloss/blob/v2-exp/borders.go#L307
Which is fair. That is a nice default.
My issue then is that none of the sizing methods work. So if I ask horizontal border size it checks if a left or right border has been set. Here is the Left side for example:
https://github.com/charmbracelet/lipgloss/blob/v2-exp/get.go#L314
But this will return 0 in the case where I only used .BorderStyle and borderLeftKey is not set explicitly.
To Reproduce
Pseudocode:
s := lipgloss.NewStyle().BorderStyle(lipgloss.NormalBorder())
s.getHorizontalBorderSize() // This returns 0 but the style will render a border
Expected behavior
Either not setting the "sides" on the border should not show it, but that would be a breaking change.
So the other option is to fix the sizing calculations in the case of "no sides" set but a style is set.
Workaround
Use the .Border instead:
s := lipgloss.NewStyle().Border(lipgloss.NormalBorder(), true, true, true, true)
s.getHorizontalBorderSize() // This returns 2 yay