Expand description
§Cursive Tree
A tree view for the Cursive TUI library.
Nodes can be leaves (no children) or branches (potentially have children) and can have custom data attached to them. Their representation can be stylized with multiple colors and effects.
Supported events:
- Up/Down keys: move selection
- PgUp/PgDown keys: move selection by 10 (configurable)
- Left/Right keys: collapse/expand selected branch node
- Enter key: toggle selected branch node collapse/expand
- “-”/“+” keys: collapse/expand selected branch and all children recursively
- Mouse click on node: select
- Mouse click to the left of the node: toggle branch collapse/expand
The TreeView’s data and behavior are backed by a TreeBackend. The nodes are stored and managed by a TreeModel. The model can be populated in advance and can also fetch data from the backend on demand, e.g. when a branch node is expanded.
Check out the examples.
§Alternatives
cursive_tree_view seems to be abandoned. It is written for an older version of Cursive but may still work.
§License
Like much of the Rust ecosystem, licensed under your choice of either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
All code and documentation was written by humans. We do not accept “AI”-generated contributions.
Structs§
- Node
- Tree node.
- Node
Iterator - Tree node iterator.
- Node
List - Tree node list.
- Simple
Tree Backend - Simple tree view backend.
- Tree
Model - Tree model.
- Tree
View - Tree view.
Enums§
- Branch
State - State for Branch tree node.
- Node
Kind - Tree node kind.
- Symbol
- Tree node symbol.
Constants§
- DEFAULT_
BRANCH_ COLLAPSED_ SYMBOL - Default branch collapsed symbol. Unicode U+25B6.
- DEFAULT_
BRANCH_ EXPANDED_ SYMBOL - Default branch expanded symbol. Unicode U+25BC.
- DEFAULT_
LEAF_ SYMBOL - Default leaf symbol. Unicode U+25AA.
Traits§
- Depth
- Tree node depth.
- Tree
Backend - Tree view backend.
Type Aliases§
- Node
Path - Tree node path.
- Representation
- Tree node representation.