tui-realm-treeview
tui-realm-treeview copied to clipboard
[Feature Request] - Optionally skip rendering the root node
Description
For my use case, I'm not finding it useful to be able to collapse the root node of a tree, and displaying the root node of the tree directly below the component title is a bit redundant.
There would be no reason for my users to collapse the root node, so I don't want to let them.
I'm not sure that I described that well, so here's what I'm trying to accomplish:
โญtree-viewerโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ๐ฆ Cargo.toml โ
โ target โถ โ
โ Cargo.lock โ
โ .gitignore โ
โ .git โถ โ
โ src โถ โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Changes
Add an option that when used, skips the root node like shown above.
Implementation
I am not completely up to speed yet, but I'd like to do something along the lines of
- Add a
hide_root_node
method toTreeView
- Add
hide_root_node
field toTreeWidget
- Add a separate
render_root_node
function toTreeWidget
that just iterates children ifhide_root_node
is true, or callsiter_nodes
if not.
I've implemented the render_root_node
part and things seem to work.
If the approach above sounds acceptable, I'd be happy to attempt a PR with the rest.