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

Flexbox does not render borders correctly #8

Closed
Cro0ksy opened this issue Dec 24, 2022 · 5 comments
Closed

Flexbox does not render borders correctly #8

Cro0ksy opened this issue Dec 24, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@Cro0ksy
Copy link

Cro0ksy commented Dec 24, 2022

Hello,
no matter how i attempt to tweak the boxes, there seems to be no way to get them to render the borders on all 4 sides. Is this just a problem i am having, or is this not supported?
I figured it cant draw the right border because the Flexbox always takes 100% width, even if this means not showing other content that would be on the side. Is there a way to prevent this?

Border_Issue

@76creates
Copy link
Owner

76creates commented Dec 27, 2022

Hey @Cro0ksy, thanks for reporting an issue!
I pushed a fix in this commit b66e722, pull it and give it a try, should work good ⚡

@76creates 76creates added the bug Something isn't working label Dec 27, 2022
@Cro0ksy
Copy link
Author

Cro0ksy commented Dec 27, 2022

Hey @Cro0ksy, thanks for reporting an issue! I pushed a fix in this commit b66e722, pull it and give it a try, should work good zap

Hello, thanks for the fast reply, though it appears as if the issue still isn't resolved.
The Border still does not get rendered on all 4 sides of the flexbox.
For good measure i will provide the flexbox, as well as the style definitions below.

var styleContent = lipgloss.NewStyle().
BorderStyle(lipgloss.RoundedBorder()).Align(lipgloss.Center)

func loadingModule() model {
	return model{
		flexbox:   stickers.NewFlexBox(0, 0).SetStyle(styleContent),
	}
}

func (m model) Init() tea.Cmd {
	m.flexbox.AddRows([]*stickers.FlexBoxRow{
		m.flexbox.NewRow().AddCells(
			[]*stickers.FlexBoxCell{
				stickers.NewFlexBoxCell(1, 1),
				stickers.NewFlexBoxCell(1, 1),
			},
		),
	})
	return nil
}

func (m model) View() string {
	m.flexbox.Row(0).Cell(0).SetContent("Content")
	m.flexbox.Row(0).Cell(1).SetContent("Content")
	return m.flexbox.Render()
}

Hope this helps

@76creates
Copy link
Owner

76creates commented Dec 28, 2022

Ah, I see, I fixed FlexBoxCell but you are setting a style on a FlexBox, whole other thing. Ive done a bit of digging and found series of miscalculations, now it will work as a charm(all puns intended).

Please pull new version and give it a go, you will note that style inheritance has been changed as well, you will want to check that out if you intended to pass down border style to cells ⚡

proof

@76creates
Copy link
Owner

@Cro0ksy is all well rendered, we can close this one?

@Cro0ksy
Copy link
Author

Cro0ksy commented Dec 30, 2022

Works perfectly, thanks a lot!

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