treilik / bubbleboxer

MIT License
64 stars 4 forks source link

Vertical borders still appear with noBorder set #2

Closed er4hn closed 2 years ago

er4hn commented 2 years ago

Hello,

I played with the example and changed it to the following:

        // layout-tree defintion
        m := model{tui: boxer.Boxer{}}
        rootNode := boxer.CreateNoBorderNode()
        rootNode.VerticalStacked = true
        rootNode.SizeFunc = func(_ boxer.Node, widthOrHeight int) []int {
                        return []int{
                                // since this node is vertical stacked return the height partioning since the width stays for all children fixed
                                widthOrHeight - 1,
                                1,
                                // make also sure that the amount of the returned ints match the amount of children:
                                // in this case two, but in more complex cases read the amount of the chilren from the len(boxer.Node.Children)
                        }
                }
        rootNode.Children = []boxer.Node{
                        {
                                Children: []boxer.Node{
                                        // make sure to encapsulate the models into a leaf with CreateLeaf:
                                        m.tui.CreateLeaf(leftAddr, left),
                                        m.tui.CreateLeaf(middleAddr, middle),
                                        m.tui.CreateLeaf(rightAddr, right),
                                },
                        },
                        m.tui.CreateLeaf(lowerAddr, lower),
                }
        m.tui.LayoutTree = rootNode

When rendering I see the following:

left        │middle     │right      
            │           │           
            │           │           
            │           │           
lower: use ctrl+c to quit

I would expect to not see the | bars due to the root being a NoBorderNode. Filing as an issue under the assumption that those bars should not be present.

Cheers!

treilik commented 2 years ago

Thanks for the Issue! But this is by design. The RootNode is a NoBorderNode but the contained one is not a NoBorderNode, so it has borders again. So you have to make all nodes NoBorderNode's when you don't want borders anywhere.

Cheers!