Hide() child in lipgloss/tree #452
Replies: 2 comments 7 replies
-
|
Hey looking into this - I think there are some bugs that you've pointed out here that we will work on. Thanks for sharing this, it'll be super helpful while we work on fixing this |
Beta Was this translation helpful? Give feedback.
-
|
Hello @bashbunni I'm back with some news. Then I thought I'll look at the implementation of the tree package, but my eyes are not used to reading Golang code and also I never learned Go, so I decided to write my own tree to see if I can find a way without any drawing issues. I guess I found a smart way to create the lines in a tree without issues. Here is an image that showcases what the code can do. So you see with just a few lines I can render the trees in different ways. As examples I implemented 4 different styles. For the last folder style one I introduced a hidechildren boolean, which I need for displaying open or closed folders. The concept is very simple. I have a FILO stack that I pass to the rendering functions, and therefore I know for each line that I want to render exactly which characters to draw, because I can calculate/determine whatever I need with that data. If you want my concept code please let me know. With that I wanna say thank you for all your support, and I think we can close now this issue. All the best --marco |
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
-
Hello reader,
Question 1
TLDR
how can I hide a child/leaf in a tree without using Root()?
Long question
I have the following code, where I'm trying to hide the second child.
I understand why it doesn't work, because Child() returns T and not the second child.
I can work my way around by using another Root()
Okay, but I'm still wondering how to hide that second child without using another Root node. Is it even possible?
I then tried to get the second child and hide it.
Which gives the following error message
T.Children().At(1).Hide undefined (type tree.Node has no field or method Hide)Question 2
I have these 4 code snippets with corresponding output ...
As you can see in snippet number 3 the line is not drawn correctly, it should look like the output of snippet number 1. Is this something I have to take care of myself, or do I have to live with it, or can this safely be considered a bug?
Thank you very much for your support
--marco
Beta Was this translation helpful? Give feedback.
All reactions