diff options
author | notoria | 2021-06-06 15:55:05 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-10 13:00:08 +0000 |
commit | 1a3a92463405fdd4738fbdbfda212aef58a2919d (patch) | |
tree | bc47fdc4957a6890cbad286c52a445ba5d96da9a /helix-view/src/tree.rs | |
parent | aebdef8257173b31df77ae02bb23ec2abfd07e5c (diff) |
Implement Debug for data structure as a feature
Diffstat (limited to 'helix-view/src/tree.rs')
-rw-r--r-- | helix-view/src/tree.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/helix-view/src/tree.rs b/helix-view/src/tree.rs index 5b56156f..b5eb5d87 100644 --- a/helix-view/src/tree.rs +++ b/helix-view/src/tree.rs @@ -4,6 +4,7 @@ use tui::layout::Rect; // the dimensions are recomputed on windo resize/tree change. // +#[cfg_attr(feature = "debug", derive(Debug))] pub struct Tree { root: ViewId, // (container, index inside the container) @@ -17,11 +18,13 @@ pub struct Tree { stack: Vec<(ViewId, Rect)>, } +#[cfg_attr(feature = "debug", derive(Debug))] pub struct Node { parent: ViewId, content: Content, } +#[cfg_attr(feature = "debug", derive(Debug))] pub enum Content { View(Box<View>), Container(Box<Container>), @@ -45,6 +48,7 @@ impl Node { // TODO: screen coord to container + container coordinate helpers +#[cfg_attr(feature = "debug", derive(Debug))] #[derive(PartialEq, Eq)] pub enum Layout { Horizontal, @@ -52,6 +56,7 @@ pub enum Layout { // could explore stacked/tabbed } +#[cfg_attr(feature = "debug", derive(Debug))] pub struct Container { layout: Layout, children: Vec<ViewId>, @@ -432,6 +437,7 @@ impl Tree { } } +#[cfg_attr(feature = "debug", derive(Debug))] pub struct Traverse<'a> { tree: &'a Tree, stack: Vec<ViewId>, // TODO: reuse the one we use on update |