Closed caarlos0 closed 3 months ago
If you don't mind, going to look at a few last things today before we merge this one.
Hey @meowgorithm any changes on this one?
Let’s get the tree examples back in as well — I'm looking at stuff now.
@meowgorithm kk no rush. Just added the examples back
Removed JoinVertical
from the final rendered element as it was writing unstyled whitespace to the final string. It does that by design to appropriately align elements in the block, but because it doesn't have access to the style, the whitespace can't be rendered. That said, I haven't seen this issue outside of the tree examples, so it's not pressing.
If we did want to fix this we could replace this whitespace rendering with calling Align
on the style which can render the whitespace properly or fix this with our compositor in a future version of lipgloss
I thought the lipgloss root styling might be broken because if we do
ItemStyleFunc(func(children tree.Children, i int) lipgloss.Style {
if children.At(i).Value() == "Nyx" {
return itemStyle.Background(lipgloss.Color("#04B575"))
}
return itemStyle
})
we get
%!v(PANIC=String method: runtime error: invalid memory address or nil pointer dereference)
because when we're on the root item, it's children.At(-1)
which returns nil
, then we attempt to call Value()
on it.
As-is we will always need to do a root value check in ItemStyleFunc
to avoid this...
We might even want to see about separating out RootStyle
from ItemStyle
ðŸ’
We might even want to see about separating out
RootStyle
fromItemStyle
ðŸ’
i think that makes more sense yes
closes #339 closes #341