-
Notifications
You must be signed in to change notification settings - Fork 1
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
horizontal layout without boxes #23
Comments
Is this what you are thinking about?
|
yes, a tree but without boxes |
So what we need to change is this file: https://github.com/yzhong52/ascii_tree/blob/main/src/tree/vertical.rs#L144 Either pass in another variable:
or make
And based on that, change some measuring code such as: https://github.com/yzhong52/ascii_tree/blob/main/src/tree/vertical.rs#L62 On top of that, if you looking to minimize horizontal space, there is this constant that is set to 2, meaning the space between children is two white spaces. We can make that a argument for the CLI as well https://github.com/yzhong52/ascii_tree/blob/main/src/tree/vertical.rs#L8 Would you be interested in giving those a try? |
No, I'm not interested ... but the reason is that I don't program in rust (yet) :) I'm working on https://github.com/nkh/P5-App-Asciio where I'm planning to list a set of utilities that can be use to generate elements. There are plenty utilities generating vertical layout but few generating horizontal layout. Here you can see why the larger ooutput is not very usable for more than a handful of nodes. |
Cool, thanks for sharing the motivations :) I can work on that. But it won't fully solve your problem though. With you example, it will only save 10 chars (|), and that won't be enough to draw the entire tree. I can add another option to wrap text automatically maybe. Could you c/p me your input? I can use that for testing later. |
true it won't save much in this example (https://github.com/nkh/P5-App-Asciio/blob/master/README.md) but people can tweak their input, and having the boxes or not is a good option. it would be interesting to look at other algorithms that pack the horizontal tree better by using free space (nothing under 'interface' and 'Exporting to ASCII) https://cs.brown.edu/people/rtamassi/gdhandbook/chapters/trees.pdf, http://llimllib.github.io/pymag-trees/ and a million other ... I did notice that GUI, TUI, SYNOPSIS, DESCRIPTION are not part of the tree, IE: level one entries are not under a virtual root which makes the graph ... vertical too |
Oh, I didn't realize that it is from the readme lol.
Yep, absolutely. There are certainly more ways to compact this :)
Yep, for vertical - it is using a dot for root. For horizontal, I don't really want to create an artificial root. |
This is what I have for now. With your input, the width of the output is 169 chars.
Edit: #24 |
I also removed the horizontal spacing, since that's trivial to do:
That makes it 149 chars. Edit: #25 |
great, 20 chars is already a lot. removing the bozes should remove another 40 chars, so a total of around 30% |
Any chance to have a --style none which would not add boxes? even on a 200 characters wide terminal it's difficult to print anything that more than a few elements wide
The text was updated successfully, but these errors were encountered: