Skip to content
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

Setting BorderTop(false) disappears entire border #194

Open
haarts opened this issue Apr 12, 2023 · 3 comments
Open

Setting BorderTop(false) disappears entire border #194

haarts opened this issue Apr 12, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@haarts
Copy link

haarts commented Apr 12, 2023

Hi all!

I'm having a blast with Bubbletea and Lipgloss, but I misunderstood something.

leftOnly = lipgloss.NewStyle().
		BorderStyle(lipgloss.Border{Left: "   new             "}).
		BorderTop(false). //these are the problem
		BorderRight(false). //
		BorderBottom(false).  //
                BorderForeground(neonOrange);
leftOnly.Render("some cyberpunk text");

Without these Border{Top,Right,Bottom} calls I get a lovely neon orange border around my text. But as soon as I call one of these the border disappears entirely. I would have expected that the respective border would not have been rendered?

(I don't think it has anything to do with the hack I used to display the text "new" vertically in the left border.)

@meowgorithm
Copy link
Member

Good catch! I'd classify this as a bug. This also begs reexamining the behavior here in general:

Right now, if a style has a border set, but no specific top/bottom/left/right rules, the border applies to the entire box. As soon as one of the sides has a border true value, the other borders are treated as false.

Irrespective of breaking API changes, do we think this type of logic still makes sense?

@meowgorithm meowgorithm added the bug Something isn't working label Apr 12, 2023
@haarts
Copy link
Author

haarts commented Apr 13, 2023

In general, I would like to have more control over the borders (I'm massively biased because I'm trying to create a 'cyberpunk' feel to the interface I'm writing).
In that sense, the behaviour you are describing would be suboptimal. (To paraphrase you in order to check if I understand correctly: if you use a border with a true value (via BorderBottom(true) for example) the other borders disappear.
I would like the ability to true off and on each individual border.

On a slightly related note: adding Blink(true) to a border didn't have any effect. Perhaps intentional?

@meowgorithm
Copy link
Member

Oh, to clarify, you can always turn borders back on once they’re auto-set to false. What I’m describing is just default behavior which can always be overridden.

As for blink, it won’t affect borders however it is possible to make borders blink (with a little work) using Bubble Tea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants