Take a look at https://github.com/billvanyo/tree_printer.
It is capable of using as much space as possible - child branches can overflow under sibling parent branches, which makes the tree look a lot more compact. Something like that would be nice to have
Another nice feature would be to compress row spacing to compress rows:
1
└┐ <-- one row for branches instead of 2
20
┌─────┴─────┐
15 24
┌───┴───┐ ┌───┴───┐
10 19 21 27
┌──┴──┐ ┌┘ └┐ ┌─┴─┐
7 12 16 22 26 29
┌─┴─┐ ┌─┴─┐ └┐ └┐ ┌┘ ┌─┴─┐
5 8 11 14 18 23 25 28 30
┌┴┐ └┐ ┌┘ ┌┘
4 6 9 13 17
┌┘
2
└┐
3
ALSO when I pulled and debugged your lib, I saw there are a lot of writes and changes to the LineBuffer, as well as methods that return encoded values (like array of 2 elements encoding properties like position and width — maybe use records or classes with meaningful fields for them?). Maybe it would be possible to avoid changes like that if you had a dynamic list elements per row (like pad, branch, node, branch, pad) which is rewritten in some kind of two-pass bottom-up + top-down fashion?
Take a look at https://github.com/billvanyo/tree_printer.
It is capable of using as much space as possible - child branches can overflow under sibling parent branches, which makes the tree look a lot more compact. Something like that would be nice to have
Another nice feature would be to compress row spacing to compress rows:
ALSO when I pulled and debugged your lib, I saw there are a lot of writes and changes to the
LineBuffer, as well as methods that return encoded values (like array of 2 elements encoding properties like position and width — maybe use records or classes with meaningful fields for them?). Maybe it would be possible to avoid changes like that if you had a dynamic list elements per row (likepad, branch, node, branch, pad) which is rewritten in some kind of two-pass bottom-up + top-down fashion?